github.com/cloudwan/edgelq-sdk@v1.15.4/secrets/resources/v1/crypto_key/crypto_key.pb.fieldpath.go (about)

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/secrets/proto/v1/crypto_key.proto
     3  // DO NOT EDIT!!!
     4  
     5  package crypto_key
     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  	project "github.com/cloudwan/edgelq-sdk/secrets/resources/v1/project"
    27  	meta "github.com/cloudwan/goten-sdk/types/meta"
    28  )
    29  
    30  // ensure the imports are used
    31  var (
    32  	_ = new(json.Marshaler)
    33  	_ = new(fmt.Stringer)
    34  	_ = reflect.DeepEqual
    35  	_ = strings.Builder{}
    36  	_ = time.Second
    37  
    38  	_ = strcase.ToLowerCamel
    39  	_ = codes.NotFound
    40  	_ = status.Status{}
    41  	_ = protojson.UnmarshalOptions{}
    42  	_ = new(proto.Message)
    43  	_ = protoregistry.GlobalTypes
    44  
    45  	_ = new(gotenobject.FieldPath)
    46  )
    47  
    48  // make sure we're using proto imports
    49  var (
    50  	_ = &project.Project{}
    51  	_ = &meta.Meta{}
    52  )
    53  
    54  // FieldPath provides implementation to handle
    55  // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto
    56  type CryptoKey_FieldPath interface {
    57  	gotenobject.FieldPath
    58  	Selector() CryptoKey_FieldPathSelector
    59  	Get(source *CryptoKey) []interface{}
    60  	GetSingle(source *CryptoKey) (interface{}, bool)
    61  	ClearValue(item *CryptoKey)
    62  
    63  	// Those methods build corresponding CryptoKey_FieldPathValue
    64  	// (or array of values) and holds passed value. Panics if injected type is incorrect.
    65  	WithIValue(value interface{}) CryptoKey_FieldPathValue
    66  	WithIArrayOfValues(values interface{}) CryptoKey_FieldPathArrayOfValues
    67  	WithIArrayItemValue(value interface{}) CryptoKey_FieldPathArrayItemValue
    68  }
    69  
    70  type CryptoKey_FieldPathSelector int32
    71  
    72  const (
    73  	CryptoKey_FieldPathSelectorName     CryptoKey_FieldPathSelector = 0
    74  	CryptoKey_FieldPathSelectorMetadata CryptoKey_FieldPathSelector = 1
    75  	CryptoKey_FieldPathSelectorKey      CryptoKey_FieldPathSelector = 2
    76  )
    77  
    78  func (s CryptoKey_FieldPathSelector) String() string {
    79  	switch s {
    80  	case CryptoKey_FieldPathSelectorName:
    81  		return "name"
    82  	case CryptoKey_FieldPathSelectorMetadata:
    83  		return "metadata"
    84  	case CryptoKey_FieldPathSelectorKey:
    85  		return "key"
    86  	default:
    87  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", s))
    88  	}
    89  }
    90  
    91  func BuildCryptoKey_FieldPath(fp gotenobject.RawFieldPath) (CryptoKey_FieldPath, error) {
    92  	if len(fp) == 0 {
    93  		return nil, status.Error(codes.InvalidArgument, "empty field path for object CryptoKey")
    94  	}
    95  	if len(fp) == 1 {
    96  		switch fp[0] {
    97  		case "name":
    98  			return &CryptoKey_FieldTerminalPath{selector: CryptoKey_FieldPathSelectorName}, nil
    99  		case "metadata":
   100  			return &CryptoKey_FieldTerminalPath{selector: CryptoKey_FieldPathSelectorMetadata}, nil
   101  		case "key":
   102  			return &CryptoKey_FieldTerminalPath{selector: CryptoKey_FieldPathSelectorKey}, nil
   103  		}
   104  	} else {
   105  		switch fp[0] {
   106  		case "metadata":
   107  			if subpath, err := meta.BuildMeta_FieldPath(fp[1:]); err != nil {
   108  				return nil, err
   109  			} else {
   110  				return &CryptoKey_FieldSubPath{selector: CryptoKey_FieldPathSelectorMetadata, subPath: subpath}, nil
   111  			}
   112  		}
   113  	}
   114  	return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object CryptoKey", fp)
   115  }
   116  
   117  func ParseCryptoKey_FieldPath(rawField string) (CryptoKey_FieldPath, error) {
   118  	fp, err := gotenobject.ParseRawFieldPath(rawField)
   119  	if err != nil {
   120  		return nil, err
   121  	}
   122  	return BuildCryptoKey_FieldPath(fp)
   123  }
   124  
   125  func MustParseCryptoKey_FieldPath(rawField string) CryptoKey_FieldPath {
   126  	fp, err := ParseCryptoKey_FieldPath(rawField)
   127  	if err != nil {
   128  		panic(err)
   129  	}
   130  	return fp
   131  }
   132  
   133  type CryptoKey_FieldTerminalPath struct {
   134  	selector CryptoKey_FieldPathSelector
   135  }
   136  
   137  var _ CryptoKey_FieldPath = (*CryptoKey_FieldTerminalPath)(nil)
   138  
   139  func (fp *CryptoKey_FieldTerminalPath) Selector() CryptoKey_FieldPathSelector {
   140  	return fp.selector
   141  }
   142  
   143  // String returns path representation in proto convention
   144  func (fp *CryptoKey_FieldTerminalPath) String() string {
   145  	return fp.selector.String()
   146  }
   147  
   148  // JSONString returns path representation is JSON convention
   149  func (fp *CryptoKey_FieldTerminalPath) JSONString() string {
   150  	return strcase.ToLowerCamel(fp.String())
   151  }
   152  
   153  // Get returns all values pointed by specific field from source CryptoKey
   154  func (fp *CryptoKey_FieldTerminalPath) Get(source *CryptoKey) (values []interface{}) {
   155  	if source != nil {
   156  		switch fp.selector {
   157  		case CryptoKey_FieldPathSelectorName:
   158  			if source.Name != nil {
   159  				values = append(values, source.Name)
   160  			}
   161  		case CryptoKey_FieldPathSelectorMetadata:
   162  			if source.Metadata != nil {
   163  				values = append(values, source.Metadata)
   164  			}
   165  		case CryptoKey_FieldPathSelectorKey:
   166  			values = append(values, source.Key)
   167  		default:
   168  			panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fp.selector))
   169  		}
   170  	}
   171  	return
   172  }
   173  
   174  func (fp *CryptoKey_FieldTerminalPath) GetRaw(source proto.Message) []interface{} {
   175  	return fp.Get(source.(*CryptoKey))
   176  }
   177  
   178  // GetSingle returns value pointed by specific field of from source CryptoKey
   179  func (fp *CryptoKey_FieldTerminalPath) GetSingle(source *CryptoKey) (interface{}, bool) {
   180  	switch fp.selector {
   181  	case CryptoKey_FieldPathSelectorName:
   182  		res := source.GetName()
   183  		return res, res != nil
   184  	case CryptoKey_FieldPathSelectorMetadata:
   185  		res := source.GetMetadata()
   186  		return res, res != nil
   187  	case CryptoKey_FieldPathSelectorKey:
   188  		return source.GetKey(), source != nil
   189  	default:
   190  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fp.selector))
   191  	}
   192  }
   193  
   194  func (fp *CryptoKey_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) {
   195  	return fp.GetSingle(source.(*CryptoKey))
   196  }
   197  
   198  // GetDefault returns a default value of the field type
   199  func (fp *CryptoKey_FieldTerminalPath) GetDefault() interface{} {
   200  	switch fp.selector {
   201  	case CryptoKey_FieldPathSelectorName:
   202  		return (*Name)(nil)
   203  	case CryptoKey_FieldPathSelectorMetadata:
   204  		return (*meta.Meta)(nil)
   205  	case CryptoKey_FieldPathSelectorKey:
   206  		return ""
   207  	default:
   208  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fp.selector))
   209  	}
   210  }
   211  
   212  func (fp *CryptoKey_FieldTerminalPath) ClearValue(item *CryptoKey) {
   213  	if item != nil {
   214  		switch fp.selector {
   215  		case CryptoKey_FieldPathSelectorName:
   216  			item.Name = nil
   217  		case CryptoKey_FieldPathSelectorMetadata:
   218  			item.Metadata = nil
   219  		case CryptoKey_FieldPathSelectorKey:
   220  			item.Key = ""
   221  		default:
   222  			panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fp.selector))
   223  		}
   224  	}
   225  }
   226  
   227  func (fp *CryptoKey_FieldTerminalPath) ClearValueRaw(item proto.Message) {
   228  	fp.ClearValue(item.(*CryptoKey))
   229  }
   230  
   231  // IsLeaf - whether field path is holds simple value
   232  func (fp *CryptoKey_FieldTerminalPath) IsLeaf() bool {
   233  	return fp.selector == CryptoKey_FieldPathSelectorName ||
   234  		fp.selector == CryptoKey_FieldPathSelectorKey
   235  }
   236  
   237  func (fp *CryptoKey_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath {
   238  	return []gotenobject.FieldPath{fp}
   239  }
   240  
   241  func (fp *CryptoKey_FieldTerminalPath) WithIValue(value interface{}) CryptoKey_FieldPathValue {
   242  	switch fp.selector {
   243  	case CryptoKey_FieldPathSelectorName:
   244  		return &CryptoKey_FieldTerminalPathValue{CryptoKey_FieldTerminalPath: *fp, value: value.(*Name)}
   245  	case CryptoKey_FieldPathSelectorMetadata:
   246  		return &CryptoKey_FieldTerminalPathValue{CryptoKey_FieldTerminalPath: *fp, value: value.(*meta.Meta)}
   247  	case CryptoKey_FieldPathSelectorKey:
   248  		return &CryptoKey_FieldTerminalPathValue{CryptoKey_FieldTerminalPath: *fp, value: value.(string)}
   249  	default:
   250  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fp.selector))
   251  	}
   252  }
   253  
   254  func (fp *CryptoKey_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue {
   255  	return fp.WithIValue(value)
   256  }
   257  
   258  func (fp *CryptoKey_FieldTerminalPath) WithIArrayOfValues(values interface{}) CryptoKey_FieldPathArrayOfValues {
   259  	fpaov := &CryptoKey_FieldTerminalPathArrayOfValues{CryptoKey_FieldTerminalPath: *fp}
   260  	switch fp.selector {
   261  	case CryptoKey_FieldPathSelectorName:
   262  		return &CryptoKey_FieldTerminalPathArrayOfValues{CryptoKey_FieldTerminalPath: *fp, values: values.([]*Name)}
   263  	case CryptoKey_FieldPathSelectorMetadata:
   264  		return &CryptoKey_FieldTerminalPathArrayOfValues{CryptoKey_FieldTerminalPath: *fp, values: values.([]*meta.Meta)}
   265  	case CryptoKey_FieldPathSelectorKey:
   266  		return &CryptoKey_FieldTerminalPathArrayOfValues{CryptoKey_FieldTerminalPath: *fp, values: values.([]string)}
   267  	default:
   268  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fp.selector))
   269  	}
   270  	return fpaov
   271  }
   272  
   273  func (fp *CryptoKey_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues {
   274  	return fp.WithIArrayOfValues(values)
   275  }
   276  
   277  func (fp *CryptoKey_FieldTerminalPath) WithIArrayItemValue(value interface{}) CryptoKey_FieldPathArrayItemValue {
   278  	switch fp.selector {
   279  	default:
   280  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fp.selector))
   281  	}
   282  }
   283  
   284  func (fp *CryptoKey_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue {
   285  	return fp.WithIArrayItemValue(value)
   286  }
   287  
   288  type CryptoKey_FieldSubPath struct {
   289  	selector CryptoKey_FieldPathSelector
   290  	subPath  gotenobject.FieldPath
   291  }
   292  
   293  var _ CryptoKey_FieldPath = (*CryptoKey_FieldSubPath)(nil)
   294  
   295  func (fps *CryptoKey_FieldSubPath) Selector() CryptoKey_FieldPathSelector {
   296  	return fps.selector
   297  }
   298  func (fps *CryptoKey_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) {
   299  	res, ok := fps.subPath.(meta.Meta_FieldPath)
   300  	return res, ok
   301  }
   302  
   303  // String returns path representation in proto convention
   304  func (fps *CryptoKey_FieldSubPath) String() string {
   305  	return fps.selector.String() + "." + fps.subPath.String()
   306  }
   307  
   308  // JSONString returns path representation is JSON convention
   309  func (fps *CryptoKey_FieldSubPath) JSONString() string {
   310  	return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString()
   311  }
   312  
   313  // Get returns all values pointed by selected field from source CryptoKey
   314  func (fps *CryptoKey_FieldSubPath) Get(source *CryptoKey) (values []interface{}) {
   315  	switch fps.selector {
   316  	case CryptoKey_FieldPathSelectorMetadata:
   317  		values = append(values, fps.subPath.GetRaw(source.GetMetadata())...)
   318  	default:
   319  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fps.selector))
   320  	}
   321  	return
   322  }
   323  
   324  func (fps *CryptoKey_FieldSubPath) GetRaw(source proto.Message) []interface{} {
   325  	return fps.Get(source.(*CryptoKey))
   326  }
   327  
   328  // GetSingle returns value of selected field from source CryptoKey
   329  func (fps *CryptoKey_FieldSubPath) GetSingle(source *CryptoKey) (interface{}, bool) {
   330  	switch fps.selector {
   331  	case CryptoKey_FieldPathSelectorMetadata:
   332  		if source.GetMetadata() == nil {
   333  			return nil, false
   334  		}
   335  		return fps.subPath.GetSingleRaw(source.GetMetadata())
   336  	default:
   337  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fps.selector))
   338  	}
   339  }
   340  
   341  func (fps *CryptoKey_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) {
   342  	return fps.GetSingle(source.(*CryptoKey))
   343  }
   344  
   345  // GetDefault returns a default value of the field type
   346  func (fps *CryptoKey_FieldSubPath) GetDefault() interface{} {
   347  	return fps.subPath.GetDefault()
   348  }
   349  
   350  func (fps *CryptoKey_FieldSubPath) ClearValue(item *CryptoKey) {
   351  	if item != nil {
   352  		switch fps.selector {
   353  		case CryptoKey_FieldPathSelectorMetadata:
   354  			fps.subPath.ClearValueRaw(item.Metadata)
   355  		default:
   356  			panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fps.selector))
   357  		}
   358  	}
   359  }
   360  
   361  func (fps *CryptoKey_FieldSubPath) ClearValueRaw(item proto.Message) {
   362  	fps.ClearValue(item.(*CryptoKey))
   363  }
   364  
   365  // IsLeaf - whether field path is holds simple value
   366  func (fps *CryptoKey_FieldSubPath) IsLeaf() bool {
   367  	return fps.subPath.IsLeaf()
   368  }
   369  
   370  func (fps *CryptoKey_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath {
   371  	iPaths := []gotenobject.FieldPath{&CryptoKey_FieldTerminalPath{selector: fps.selector}}
   372  	iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...)
   373  	return iPaths
   374  }
   375  
   376  func (fps *CryptoKey_FieldSubPath) WithIValue(value interface{}) CryptoKey_FieldPathValue {
   377  	return &CryptoKey_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)}
   378  }
   379  
   380  func (fps *CryptoKey_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue {
   381  	return fps.WithIValue(value)
   382  }
   383  
   384  func (fps *CryptoKey_FieldSubPath) WithIArrayOfValues(values interface{}) CryptoKey_FieldPathArrayOfValues {
   385  	return &CryptoKey_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)}
   386  }
   387  
   388  func (fps *CryptoKey_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues {
   389  	return fps.WithIArrayOfValues(values)
   390  }
   391  
   392  func (fps *CryptoKey_FieldSubPath) WithIArrayItemValue(value interface{}) CryptoKey_FieldPathArrayItemValue {
   393  	return &CryptoKey_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)}
   394  }
   395  
   396  func (fps *CryptoKey_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue {
   397  	return fps.WithIArrayItemValue(value)
   398  }
   399  
   400  // CryptoKey_FieldPathValue allows storing values for CryptoKey fields according to their type
   401  type CryptoKey_FieldPathValue interface {
   402  	CryptoKey_FieldPath
   403  	gotenobject.FieldPathValue
   404  	SetTo(target **CryptoKey)
   405  	CompareWith(*CryptoKey) (cmp int, comparable bool)
   406  }
   407  
   408  func ParseCryptoKey_FieldPathValue(pathStr, valueStr string) (CryptoKey_FieldPathValue, error) {
   409  	fp, err := ParseCryptoKey_FieldPath(pathStr)
   410  	if err != nil {
   411  		return nil, err
   412  	}
   413  	fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr)
   414  	if err != nil {
   415  		return nil, status.Errorf(codes.InvalidArgument, "error parsing CryptoKey field path value from %s: %v", valueStr, err)
   416  	}
   417  	return fpv.(CryptoKey_FieldPathValue), nil
   418  }
   419  
   420  func MustParseCryptoKey_FieldPathValue(pathStr, valueStr string) CryptoKey_FieldPathValue {
   421  	fpv, err := ParseCryptoKey_FieldPathValue(pathStr, valueStr)
   422  	if err != nil {
   423  		panic(err)
   424  	}
   425  	return fpv
   426  }
   427  
   428  type CryptoKey_FieldTerminalPathValue struct {
   429  	CryptoKey_FieldTerminalPath
   430  	value interface{}
   431  }
   432  
   433  var _ CryptoKey_FieldPathValue = (*CryptoKey_FieldTerminalPathValue)(nil)
   434  
   435  // GetRawValue returns raw value stored under selected path for 'CryptoKey' as interface{}
   436  func (fpv *CryptoKey_FieldTerminalPathValue) GetRawValue() interface{} {
   437  	return fpv.value
   438  }
   439  func (fpv *CryptoKey_FieldTerminalPathValue) AsNameValue() (*Name, bool) {
   440  	res, ok := fpv.value.(*Name)
   441  	return res, ok
   442  }
   443  func (fpv *CryptoKey_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) {
   444  	res, ok := fpv.value.(*meta.Meta)
   445  	return res, ok
   446  }
   447  func (fpv *CryptoKey_FieldTerminalPathValue) AsKeyValue() (string, bool) {
   448  	res, ok := fpv.value.(string)
   449  	return res, ok
   450  }
   451  
   452  // SetTo stores value for selected field for object CryptoKey
   453  func (fpv *CryptoKey_FieldTerminalPathValue) SetTo(target **CryptoKey) {
   454  	if *target == nil {
   455  		*target = new(CryptoKey)
   456  	}
   457  	switch fpv.selector {
   458  	case CryptoKey_FieldPathSelectorName:
   459  		(*target).Name = fpv.value.(*Name)
   460  	case CryptoKey_FieldPathSelectorMetadata:
   461  		(*target).Metadata = fpv.value.(*meta.Meta)
   462  	case CryptoKey_FieldPathSelectorKey:
   463  		(*target).Key = fpv.value.(string)
   464  	default:
   465  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fpv.selector))
   466  	}
   467  }
   468  
   469  func (fpv *CryptoKey_FieldTerminalPathValue) SetToRaw(target proto.Message) {
   470  	typedObject := target.(*CryptoKey)
   471  	fpv.SetTo(&typedObject)
   472  }
   473  
   474  // CompareWith compares value in the 'CryptoKey_FieldTerminalPathValue' with the value under path in 'CryptoKey'.
   475  func (fpv *CryptoKey_FieldTerminalPathValue) CompareWith(source *CryptoKey) (int, bool) {
   476  	switch fpv.selector {
   477  	case CryptoKey_FieldPathSelectorName:
   478  		leftValue := fpv.value.(*Name)
   479  		rightValue := source.GetName()
   480  		if leftValue == nil {
   481  			if rightValue != nil {
   482  				return -1, true
   483  			}
   484  			return 0, true
   485  		}
   486  		if rightValue == nil {
   487  			return 1, true
   488  		}
   489  		if leftValue.String() == rightValue.String() {
   490  			return 0, true
   491  		} else if leftValue.String() < rightValue.String() {
   492  			return -1, true
   493  		} else {
   494  			return 1, true
   495  		}
   496  	case CryptoKey_FieldPathSelectorMetadata:
   497  		return 0, false
   498  	case CryptoKey_FieldPathSelectorKey:
   499  		leftValue := fpv.value.(string)
   500  		rightValue := source.GetKey()
   501  		if (leftValue) == (rightValue) {
   502  			return 0, true
   503  		} else if (leftValue) < (rightValue) {
   504  			return -1, true
   505  		} else {
   506  			return 1, true
   507  		}
   508  	default:
   509  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fpv.selector))
   510  	}
   511  }
   512  
   513  func (fpv *CryptoKey_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) {
   514  	return fpv.CompareWith(source.(*CryptoKey))
   515  }
   516  
   517  type CryptoKey_FieldSubPathValue struct {
   518  	CryptoKey_FieldPath
   519  	subPathValue gotenobject.FieldPathValue
   520  }
   521  
   522  var _ CryptoKey_FieldPathValue = (*CryptoKey_FieldSubPathValue)(nil)
   523  
   524  func (fpvs *CryptoKey_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) {
   525  	res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue)
   526  	return res, ok
   527  }
   528  
   529  func (fpvs *CryptoKey_FieldSubPathValue) SetTo(target **CryptoKey) {
   530  	if *target == nil {
   531  		*target = new(CryptoKey)
   532  	}
   533  	switch fpvs.Selector() {
   534  	case CryptoKey_FieldPathSelectorMetadata:
   535  		fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata)
   536  	default:
   537  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fpvs.Selector()))
   538  	}
   539  }
   540  
   541  func (fpvs *CryptoKey_FieldSubPathValue) SetToRaw(target proto.Message) {
   542  	typedObject := target.(*CryptoKey)
   543  	fpvs.SetTo(&typedObject)
   544  }
   545  
   546  func (fpvs *CryptoKey_FieldSubPathValue) GetRawValue() interface{} {
   547  	return fpvs.subPathValue.GetRawValue()
   548  }
   549  
   550  func (fpvs *CryptoKey_FieldSubPathValue) CompareWith(source *CryptoKey) (int, bool) {
   551  	switch fpvs.Selector() {
   552  	case CryptoKey_FieldPathSelectorMetadata:
   553  		return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata())
   554  	default:
   555  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fpvs.Selector()))
   556  	}
   557  }
   558  
   559  func (fpvs *CryptoKey_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) {
   560  	return fpvs.CompareWith(source.(*CryptoKey))
   561  }
   562  
   563  // CryptoKey_FieldPathArrayItemValue allows storing single item in Path-specific values for CryptoKey according to their type
   564  // Present only for array (repeated) types.
   565  type CryptoKey_FieldPathArrayItemValue interface {
   566  	gotenobject.FieldPathArrayItemValue
   567  	CryptoKey_FieldPath
   568  	ContainsValue(*CryptoKey) bool
   569  }
   570  
   571  // ParseCryptoKey_FieldPathArrayItemValue parses string and JSON-encoded value to its Value
   572  func ParseCryptoKey_FieldPathArrayItemValue(pathStr, valueStr string) (CryptoKey_FieldPathArrayItemValue, error) {
   573  	fp, err := ParseCryptoKey_FieldPath(pathStr)
   574  	if err != nil {
   575  		return nil, err
   576  	}
   577  	fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr)
   578  	if err != nil {
   579  		return nil, status.Errorf(codes.InvalidArgument, "error parsing CryptoKey field path array item value from %s: %v", valueStr, err)
   580  	}
   581  	return fpaiv.(CryptoKey_FieldPathArrayItemValue), nil
   582  }
   583  
   584  func MustParseCryptoKey_FieldPathArrayItemValue(pathStr, valueStr string) CryptoKey_FieldPathArrayItemValue {
   585  	fpaiv, err := ParseCryptoKey_FieldPathArrayItemValue(pathStr, valueStr)
   586  	if err != nil {
   587  		panic(err)
   588  	}
   589  	return fpaiv
   590  }
   591  
   592  type CryptoKey_FieldTerminalPathArrayItemValue struct {
   593  	CryptoKey_FieldTerminalPath
   594  	value interface{}
   595  }
   596  
   597  var _ CryptoKey_FieldPathArrayItemValue = (*CryptoKey_FieldTerminalPathArrayItemValue)(nil)
   598  
   599  // GetRawValue returns stored element value for array in object CryptoKey as interface{}
   600  func (fpaiv *CryptoKey_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} {
   601  	return fpaiv.value
   602  }
   603  
   604  func (fpaiv *CryptoKey_FieldTerminalPathArrayItemValue) GetSingle(source *CryptoKey) (interface{}, bool) {
   605  	return nil, false
   606  }
   607  
   608  func (fpaiv *CryptoKey_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) {
   609  	return fpaiv.GetSingle(source.(*CryptoKey))
   610  }
   611  
   612  // Contains returns a boolean indicating if value that is being held is present in given 'CryptoKey'
   613  func (fpaiv *CryptoKey_FieldTerminalPathArrayItemValue) ContainsValue(source *CryptoKey) bool {
   614  	slice := fpaiv.CryptoKey_FieldTerminalPath.Get(source)
   615  	for _, v := range slice {
   616  		if asProtoMsg, ok := fpaiv.value.(proto.Message); ok {
   617  			if proto.Equal(asProtoMsg, v.(proto.Message)) {
   618  				return true
   619  			}
   620  		} else if reflect.DeepEqual(v, fpaiv.value) {
   621  			return true
   622  		}
   623  	}
   624  	return false
   625  }
   626  
   627  type CryptoKey_FieldSubPathArrayItemValue struct {
   628  	CryptoKey_FieldPath
   629  	subPathItemValue gotenobject.FieldPathArrayItemValue
   630  }
   631  
   632  // GetRawValue returns stored array item value
   633  func (fpaivs *CryptoKey_FieldSubPathArrayItemValue) GetRawItemValue() interface{} {
   634  	return fpaivs.subPathItemValue.GetRawItemValue()
   635  }
   636  func (fpaivs *CryptoKey_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) {
   637  	res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue)
   638  	return res, ok
   639  }
   640  
   641  // Contains returns a boolean indicating if value that is being held is present in given 'CryptoKey'
   642  func (fpaivs *CryptoKey_FieldSubPathArrayItemValue) ContainsValue(source *CryptoKey) bool {
   643  	switch fpaivs.Selector() {
   644  	case CryptoKey_FieldPathSelectorMetadata:
   645  		return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata())
   646  	default:
   647  		panic(fmt.Sprintf("Invalid selector for CryptoKey: %d", fpaivs.Selector()))
   648  	}
   649  }
   650  
   651  // CryptoKey_FieldPathArrayOfValues allows storing slice of values for CryptoKey fields according to their type
   652  type CryptoKey_FieldPathArrayOfValues interface {
   653  	gotenobject.FieldPathArrayOfValues
   654  	CryptoKey_FieldPath
   655  }
   656  
   657  func ParseCryptoKey_FieldPathArrayOfValues(pathStr, valuesStr string) (CryptoKey_FieldPathArrayOfValues, error) {
   658  	fp, err := ParseCryptoKey_FieldPath(pathStr)
   659  	if err != nil {
   660  		return nil, err
   661  	}
   662  	fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr)
   663  	if err != nil {
   664  		return nil, status.Errorf(codes.InvalidArgument, "error parsing CryptoKey field path array of values from %s: %v", valuesStr, err)
   665  	}
   666  	return fpaov.(CryptoKey_FieldPathArrayOfValues), nil
   667  }
   668  
   669  func MustParseCryptoKey_FieldPathArrayOfValues(pathStr, valuesStr string) CryptoKey_FieldPathArrayOfValues {
   670  	fpaov, err := ParseCryptoKey_FieldPathArrayOfValues(pathStr, valuesStr)
   671  	if err != nil {
   672  		panic(err)
   673  	}
   674  	return fpaov
   675  }
   676  
   677  type CryptoKey_FieldTerminalPathArrayOfValues struct {
   678  	CryptoKey_FieldTerminalPath
   679  	values interface{}
   680  }
   681  
   682  var _ CryptoKey_FieldPathArrayOfValues = (*CryptoKey_FieldTerminalPathArrayOfValues)(nil)
   683  
   684  func (fpaov *CryptoKey_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) {
   685  	switch fpaov.selector {
   686  	case CryptoKey_FieldPathSelectorName:
   687  		for _, v := range fpaov.values.([]*Name) {
   688  			values = append(values, v)
   689  		}
   690  	case CryptoKey_FieldPathSelectorMetadata:
   691  		for _, v := range fpaov.values.([]*meta.Meta) {
   692  			values = append(values, v)
   693  		}
   694  	case CryptoKey_FieldPathSelectorKey:
   695  		for _, v := range fpaov.values.([]string) {
   696  			values = append(values, v)
   697  		}
   698  	}
   699  	return
   700  }
   701  func (fpaov *CryptoKey_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) {
   702  	res, ok := fpaov.values.([]*Name)
   703  	return res, ok
   704  }
   705  func (fpaov *CryptoKey_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) {
   706  	res, ok := fpaov.values.([]*meta.Meta)
   707  	return res, ok
   708  }
   709  func (fpaov *CryptoKey_FieldTerminalPathArrayOfValues) AsKeyArrayOfValues() ([]string, bool) {
   710  	res, ok := fpaov.values.([]string)
   711  	return res, ok
   712  }
   713  
   714  type CryptoKey_FieldSubPathArrayOfValues struct {
   715  	CryptoKey_FieldPath
   716  	subPathArrayOfValues gotenobject.FieldPathArrayOfValues
   717  }
   718  
   719  var _ CryptoKey_FieldPathArrayOfValues = (*CryptoKey_FieldSubPathArrayOfValues)(nil)
   720  
   721  func (fpsaov *CryptoKey_FieldSubPathArrayOfValues) GetRawValues() []interface{} {
   722  	return fpsaov.subPathArrayOfValues.GetRawValues()
   723  }
   724  func (fpsaov *CryptoKey_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) {
   725  	res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues)
   726  	return res, ok
   727  }