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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/iam/proto/v1alpha2/attestation_domain.proto
     3  // DO NOT EDIT!!!
     4  
     5  package attestation_domain
     6  
     7  import (
     8  	"encoding/json"
     9  	"strings"
    10  
    11  	"google.golang.org/grpc/codes"
    12  	"google.golang.org/grpc/status"
    13  	"google.golang.org/protobuf/proto"
    14  	preflect "google.golang.org/protobuf/reflect/protoreflect"
    15  	googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    16  
    17  	gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
    18  )
    19  
    20  // proto imports
    21  import (
    22  	iam_common "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/common"
    23  	project "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/project"
    24  	meta "github.com/cloudwan/goten-sdk/types/meta"
    25  )
    26  
    27  // ensure the imports are used
    28  var (
    29  	_ = new(json.Marshaler)
    30  	_ = strings.Builder{}
    31  
    32  	_ = codes.NotFound
    33  	_ = status.Status{}
    34  	_ = new(proto.Message)
    35  	_ = new(preflect.Message)
    36  	_ = googlefieldmaskpb.FieldMask{}
    37  
    38  	_ = new(gotenobject.FieldMask)
    39  )
    40  
    41  // make sure we're using proto imports
    42  var (
    43  	_ = &iam_common.PCR{}
    44  	_ = &project.Project{}
    45  	_ = &meta.Meta{}
    46  )
    47  
    48  type AttestationDomain_FieldMask struct {
    49  	Paths []AttestationDomain_FieldPath
    50  }
    51  
    52  func FullAttestationDomain_FieldMask() *AttestationDomain_FieldMask {
    53  	res := &AttestationDomain_FieldMask{}
    54  	res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorMetadata})
    55  	res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorName})
    56  	res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorDisplayName})
    57  	res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorInsecureSkipManufacturerEkcertVerification})
    58  	res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorPolicies})
    59  	res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorEnrollmentList})
    60  	return res
    61  }
    62  
    63  func (fieldMask *AttestationDomain_FieldMask) String() string {
    64  	if fieldMask == nil {
    65  		return "<nil>"
    66  	}
    67  	pathsStr := make([]string, 0, len(fieldMask.Paths))
    68  	for _, path := range fieldMask.Paths {
    69  		pathsStr = append(pathsStr, path.String())
    70  	}
    71  	return strings.Join(pathsStr, ", ")
    72  }
    73  
    74  func (fieldMask *AttestationDomain_FieldMask) IsFull() bool {
    75  	if fieldMask == nil {
    76  		return false
    77  	}
    78  	presentSelectors := make([]bool, 6)
    79  	for _, path := range fieldMask.Paths {
    80  		if asFinal, ok := path.(*AttestationDomain_FieldTerminalPath); ok {
    81  			presentSelectors[int(asFinal.selector)] = true
    82  		}
    83  	}
    84  	for _, flag := range presentSelectors {
    85  		if !flag {
    86  			return false
    87  		}
    88  	}
    89  	return true
    90  }
    91  
    92  func (fieldMask *AttestationDomain_FieldMask) ProtoReflect() preflect.Message {
    93  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
    94  		return ParseAttestationDomain_FieldPath(raw)
    95  	})
    96  }
    97  
    98  func (fieldMask *AttestationDomain_FieldMask) ProtoMessage() {}
    99  
   100  func (fieldMask *AttestationDomain_FieldMask) Reset() {
   101  	if fieldMask != nil {
   102  		fieldMask.Paths = nil
   103  	}
   104  }
   105  
   106  func (fieldMask *AttestationDomain_FieldMask) Subtract(other *AttestationDomain_FieldMask) *AttestationDomain_FieldMask {
   107  	result := &AttestationDomain_FieldMask{}
   108  	removedSelectors := make([]bool, 6)
   109  	otherSubMasks := map[AttestationDomain_FieldPathSelector]gotenobject.FieldMask{
   110  		AttestationDomain_FieldPathSelectorMetadata:       &meta.Meta_FieldMask{},
   111  		AttestationDomain_FieldPathSelectorPolicies:       &AttestationDomain_Policy_FieldMask{},
   112  		AttestationDomain_FieldPathSelectorEnrollmentList: &AttestationDomain_EnrolledKey_FieldMask{},
   113  	}
   114  	mySubMasks := map[AttestationDomain_FieldPathSelector]gotenobject.FieldMask{
   115  		AttestationDomain_FieldPathSelectorMetadata:       &meta.Meta_FieldMask{},
   116  		AttestationDomain_FieldPathSelectorPolicies:       &AttestationDomain_Policy_FieldMask{},
   117  		AttestationDomain_FieldPathSelectorEnrollmentList: &AttestationDomain_EnrolledKey_FieldMask{},
   118  	}
   119  
   120  	for _, path := range other.GetPaths() {
   121  		switch tp := path.(type) {
   122  		case *AttestationDomain_FieldTerminalPath:
   123  			removedSelectors[int(tp.selector)] = true
   124  		case *AttestationDomain_FieldSubPath:
   125  			otherSubMasks[tp.selector].AppendRawPath(tp.subPath)
   126  		}
   127  	}
   128  	for _, path := range fieldMask.GetPaths() {
   129  		if !removedSelectors[int(path.Selector())] {
   130  			if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 {
   131  				if tp, ok := path.(*AttestationDomain_FieldTerminalPath); ok {
   132  					switch tp.selector {
   133  					case AttestationDomain_FieldPathSelectorMetadata:
   134  						mySubMasks[AttestationDomain_FieldPathSelectorMetadata] = meta.FullMeta_FieldMask()
   135  					case AttestationDomain_FieldPathSelectorPolicies:
   136  						mySubMasks[AttestationDomain_FieldPathSelectorPolicies] = FullAttestationDomain_Policy_FieldMask()
   137  					case AttestationDomain_FieldPathSelectorEnrollmentList:
   138  						mySubMasks[AttestationDomain_FieldPathSelectorEnrollmentList] = FullAttestationDomain_EnrolledKey_FieldMask()
   139  					}
   140  				} else if tp, ok := path.(*AttestationDomain_FieldSubPath); ok {
   141  					mySubMasks[tp.selector].AppendRawPath(tp.subPath)
   142  				}
   143  			} else {
   144  				result.Paths = append(result.Paths, path)
   145  			}
   146  		}
   147  	}
   148  	for selector, mySubMask := range mySubMasks {
   149  		if mySubMask.PathsCount() > 0 {
   150  			for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() {
   151  				result.Paths = append(result.Paths, &AttestationDomain_FieldSubPath{selector: selector, subPath: allowedPath})
   152  			}
   153  		}
   154  	}
   155  
   156  	if len(result.Paths) == 0 {
   157  		return nil
   158  	}
   159  	return result
   160  }
   161  
   162  func (fieldMask *AttestationDomain_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   163  	return fieldMask.Subtract(other.(*AttestationDomain_FieldMask))
   164  }
   165  
   166  // FilterInputFields generates copy of field paths with output_only field paths removed
   167  func (fieldMask *AttestationDomain_FieldMask) FilterInputFields() *AttestationDomain_FieldMask {
   168  	result := &AttestationDomain_FieldMask{}
   169  	for _, path := range fieldMask.Paths {
   170  		switch path.Selector() {
   171  		case AttestationDomain_FieldPathSelectorMetadata:
   172  			if _, ok := path.(*AttestationDomain_FieldTerminalPath); ok {
   173  				for _, subpath := range meta.FullMeta_FieldMask().FilterInputFields().Paths {
   174  					result.Paths = append(result.Paths, &AttestationDomain_FieldSubPath{selector: path.Selector(), subPath: subpath})
   175  				}
   176  			} else if sub, ok := path.(*AttestationDomain_FieldSubPath); ok {
   177  				selectedMask := &meta.Meta_FieldMask{
   178  					Paths: []meta.Meta_FieldPath{sub.subPath.(meta.Meta_FieldPath)},
   179  				}
   180  				for _, allowedPath := range selectedMask.FilterInputFields().Paths {
   181  					result.Paths = append(result.Paths, &AttestationDomain_FieldSubPath{selector: AttestationDomain_FieldPathSelectorMetadata, subPath: allowedPath})
   182  				}
   183  			}
   184  		default:
   185  			result.Paths = append(result.Paths, path)
   186  		}
   187  	}
   188  	return result
   189  }
   190  
   191  // ToFieldMask is used for proto conversions
   192  func (fieldMask *AttestationDomain_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   193  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   194  	for _, path := range fieldMask.Paths {
   195  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   196  	}
   197  	return protoFieldMask
   198  }
   199  
   200  func (fieldMask *AttestationDomain_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   201  	if fieldMask == nil {
   202  		return status.Error(codes.Internal, "target field mask is nil")
   203  	}
   204  	fieldMask.Paths = make([]AttestationDomain_FieldPath, 0, len(protoFieldMask.Paths))
   205  	for _, strPath := range protoFieldMask.Paths {
   206  		path, err := ParseAttestationDomain_FieldPath(strPath)
   207  		if err != nil {
   208  			return err
   209  		}
   210  		fieldMask.Paths = append(fieldMask.Paths, path)
   211  	}
   212  	return nil
   213  }
   214  
   215  // implement methods required by customType
   216  func (fieldMask AttestationDomain_FieldMask) Marshal() ([]byte, error) {
   217  	protoFieldMask := fieldMask.ToProtoFieldMask()
   218  	return proto.Marshal(protoFieldMask)
   219  }
   220  
   221  func (fieldMask *AttestationDomain_FieldMask) Unmarshal(data []byte) error {
   222  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   223  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   224  		return err
   225  	}
   226  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   227  		return err
   228  	}
   229  	return nil
   230  }
   231  
   232  func (fieldMask *AttestationDomain_FieldMask) Size() int {
   233  	return proto.Size(fieldMask.ToProtoFieldMask())
   234  }
   235  
   236  func (fieldMask AttestationDomain_FieldMask) MarshalJSON() ([]byte, error) {
   237  	return json.Marshal(fieldMask.ToProtoFieldMask())
   238  }
   239  
   240  func (fieldMask *AttestationDomain_FieldMask) UnmarshalJSON(data []byte) error {
   241  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   242  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   243  		return err
   244  	}
   245  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   246  		return err
   247  	}
   248  	return nil
   249  }
   250  
   251  func (fieldMask *AttestationDomain_FieldMask) AppendPath(path AttestationDomain_FieldPath) {
   252  	fieldMask.Paths = append(fieldMask.Paths, path)
   253  }
   254  
   255  func (fieldMask *AttestationDomain_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   256  	fieldMask.Paths = append(fieldMask.Paths, path.(AttestationDomain_FieldPath))
   257  }
   258  
   259  func (fieldMask *AttestationDomain_FieldMask) GetPaths() []AttestationDomain_FieldPath {
   260  	if fieldMask == nil {
   261  		return nil
   262  	}
   263  	return fieldMask.Paths
   264  }
   265  
   266  func (fieldMask *AttestationDomain_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   267  	if fieldMask == nil {
   268  		return nil
   269  	}
   270  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   271  	for _, path := range fieldMask.Paths {
   272  		rawPaths = append(rawPaths, path)
   273  	}
   274  	return rawPaths
   275  }
   276  
   277  func (fieldMask *AttestationDomain_FieldMask) SetFromCliFlag(raw string) error {
   278  	path, err := ParseAttestationDomain_FieldPath(raw)
   279  	if err != nil {
   280  		return err
   281  	}
   282  	fieldMask.Paths = append(fieldMask.Paths, path)
   283  	return nil
   284  }
   285  
   286  func (fieldMask *AttestationDomain_FieldMask) Set(target, source *AttestationDomain) {
   287  	for _, path := range fieldMask.Paths {
   288  		val, _ := path.GetSingle(source)
   289  		// if val is nil, then field does not exist in source, skip
   290  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   291  		if val != nil {
   292  			path.WithIValue(val).SetTo(&target)
   293  		}
   294  	}
   295  }
   296  
   297  func (fieldMask *AttestationDomain_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   298  	fieldMask.Set(target.(*AttestationDomain), source.(*AttestationDomain))
   299  }
   300  
   301  func (fieldMask *AttestationDomain_FieldMask) Project(source *AttestationDomain) *AttestationDomain {
   302  	if source == nil {
   303  		return nil
   304  	}
   305  	if fieldMask == nil {
   306  		return source
   307  	}
   308  	result := &AttestationDomain{}
   309  	metadataMask := &meta.Meta_FieldMask{}
   310  	wholeMetadataAccepted := false
   311  	policiesMask := &AttestationDomain_Policy_FieldMask{}
   312  	wholePoliciesAccepted := false
   313  	enrollmentListMask := &AttestationDomain_EnrolledKey_FieldMask{}
   314  	wholeEnrollmentListAccepted := false
   315  
   316  	for _, p := range fieldMask.Paths {
   317  		switch tp := p.(type) {
   318  		case *AttestationDomain_FieldTerminalPath:
   319  			switch tp.selector {
   320  			case AttestationDomain_FieldPathSelectorMetadata:
   321  				result.Metadata = source.Metadata
   322  				wholeMetadataAccepted = true
   323  			case AttestationDomain_FieldPathSelectorName:
   324  				result.Name = source.Name
   325  			case AttestationDomain_FieldPathSelectorDisplayName:
   326  				result.DisplayName = source.DisplayName
   327  			case AttestationDomain_FieldPathSelectorInsecureSkipManufacturerEkcertVerification:
   328  				result.InsecureSkipManufacturerEkcertVerification = source.InsecureSkipManufacturerEkcertVerification
   329  			case AttestationDomain_FieldPathSelectorPolicies:
   330  				result.Policies = source.Policies
   331  				wholePoliciesAccepted = true
   332  			case AttestationDomain_FieldPathSelectorEnrollmentList:
   333  				result.EnrollmentList = source.EnrollmentList
   334  				wholeEnrollmentListAccepted = true
   335  			}
   336  		case *AttestationDomain_FieldSubPath:
   337  			switch tp.selector {
   338  			case AttestationDomain_FieldPathSelectorMetadata:
   339  				metadataMask.AppendPath(tp.subPath.(meta.Meta_FieldPath))
   340  			case AttestationDomain_FieldPathSelectorPolicies:
   341  				policiesMask.AppendPath(tp.subPath.(AttestationDomainPolicy_FieldPath))
   342  			case AttestationDomain_FieldPathSelectorEnrollmentList:
   343  				enrollmentListMask.AppendPath(tp.subPath.(AttestationDomainEnrolledKey_FieldPath))
   344  			}
   345  		}
   346  	}
   347  	if wholeMetadataAccepted == false && len(metadataMask.Paths) > 0 {
   348  		result.Metadata = metadataMask.Project(source.GetMetadata())
   349  	}
   350  	if wholePoliciesAccepted == false && len(policiesMask.Paths) > 0 {
   351  		for _, sourceItem := range source.GetPolicies() {
   352  			result.Policies = append(result.Policies, policiesMask.Project(sourceItem))
   353  		}
   354  	}
   355  	if wholeEnrollmentListAccepted == false && len(enrollmentListMask.Paths) > 0 {
   356  		for _, sourceItem := range source.GetEnrollmentList() {
   357  			result.EnrollmentList = append(result.EnrollmentList, enrollmentListMask.Project(sourceItem))
   358  		}
   359  	}
   360  	return result
   361  }
   362  
   363  func (fieldMask *AttestationDomain_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   364  	return fieldMask.Project(source.(*AttestationDomain))
   365  }
   366  
   367  func (fieldMask *AttestationDomain_FieldMask) PathsCount() int {
   368  	if fieldMask == nil {
   369  		return 0
   370  	}
   371  	return len(fieldMask.Paths)
   372  }
   373  
   374  type AttestationDomain_Policy_FieldMask struct {
   375  	Paths []AttestationDomainPolicy_FieldPath
   376  }
   377  
   378  func FullAttestationDomain_Policy_FieldMask() *AttestationDomain_Policy_FieldMask {
   379  	res := &AttestationDomain_Policy_FieldMask{}
   380  	res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorManufacturerRootCaCertsPem})
   381  	res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorRequireEnrollment})
   382  	res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorVerifyEventLog})
   383  	res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorExpectedPcrs})
   384  	return res
   385  }
   386  
   387  func (fieldMask *AttestationDomain_Policy_FieldMask) String() string {
   388  	if fieldMask == nil {
   389  		return "<nil>"
   390  	}
   391  	pathsStr := make([]string, 0, len(fieldMask.Paths))
   392  	for _, path := range fieldMask.Paths {
   393  		pathsStr = append(pathsStr, path.String())
   394  	}
   395  	return strings.Join(pathsStr, ", ")
   396  }
   397  
   398  func (fieldMask *AttestationDomain_Policy_FieldMask) IsFull() bool {
   399  	if fieldMask == nil {
   400  		return false
   401  	}
   402  	presentSelectors := make([]bool, 4)
   403  	for _, path := range fieldMask.Paths {
   404  		if asFinal, ok := path.(*AttestationDomainPolicy_FieldTerminalPath); ok {
   405  			presentSelectors[int(asFinal.selector)] = true
   406  		}
   407  	}
   408  	for _, flag := range presentSelectors {
   409  		if !flag {
   410  			return false
   411  		}
   412  	}
   413  	return true
   414  }
   415  
   416  func (fieldMask *AttestationDomain_Policy_FieldMask) ProtoReflect() preflect.Message {
   417  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   418  		return ParseAttestationDomainPolicy_FieldPath(raw)
   419  	})
   420  }
   421  
   422  func (fieldMask *AttestationDomain_Policy_FieldMask) ProtoMessage() {}
   423  
   424  func (fieldMask *AttestationDomain_Policy_FieldMask) Reset() {
   425  	if fieldMask != nil {
   426  		fieldMask.Paths = nil
   427  	}
   428  }
   429  
   430  func (fieldMask *AttestationDomain_Policy_FieldMask) Subtract(other *AttestationDomain_Policy_FieldMask) *AttestationDomain_Policy_FieldMask {
   431  	result := &AttestationDomain_Policy_FieldMask{}
   432  	removedSelectors := make([]bool, 4)
   433  	otherSubMasks := map[AttestationDomainPolicy_FieldPathSelector]gotenobject.FieldMask{
   434  		AttestationDomainPolicy_FieldPathSelectorExpectedPcrs: &iam_common.PCR_FieldMask{},
   435  	}
   436  	mySubMasks := map[AttestationDomainPolicy_FieldPathSelector]gotenobject.FieldMask{
   437  		AttestationDomainPolicy_FieldPathSelectorExpectedPcrs: &iam_common.PCR_FieldMask{},
   438  	}
   439  
   440  	for _, path := range other.GetPaths() {
   441  		switch tp := path.(type) {
   442  		case *AttestationDomainPolicy_FieldTerminalPath:
   443  			removedSelectors[int(tp.selector)] = true
   444  		case *AttestationDomainPolicy_FieldSubPath:
   445  			otherSubMasks[tp.selector].AppendRawPath(tp.subPath)
   446  		}
   447  	}
   448  	for _, path := range fieldMask.GetPaths() {
   449  		if !removedSelectors[int(path.Selector())] {
   450  			if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 {
   451  				if tp, ok := path.(*AttestationDomainPolicy_FieldTerminalPath); ok {
   452  					switch tp.selector {
   453  					case AttestationDomainPolicy_FieldPathSelectorExpectedPcrs:
   454  						mySubMasks[AttestationDomainPolicy_FieldPathSelectorExpectedPcrs] = iam_common.FullPCR_FieldMask()
   455  					}
   456  				} else if tp, ok := path.(*AttestationDomainPolicy_FieldSubPath); ok {
   457  					mySubMasks[tp.selector].AppendRawPath(tp.subPath)
   458  				}
   459  			} else {
   460  				result.Paths = append(result.Paths, path)
   461  			}
   462  		}
   463  	}
   464  	for selector, mySubMask := range mySubMasks {
   465  		if mySubMask.PathsCount() > 0 {
   466  			for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() {
   467  				result.Paths = append(result.Paths, &AttestationDomainPolicy_FieldSubPath{selector: selector, subPath: allowedPath})
   468  			}
   469  		}
   470  	}
   471  
   472  	if len(result.Paths) == 0 {
   473  		return nil
   474  	}
   475  	return result
   476  }
   477  
   478  func (fieldMask *AttestationDomain_Policy_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   479  	return fieldMask.Subtract(other.(*AttestationDomain_Policy_FieldMask))
   480  }
   481  
   482  // FilterInputFields generates copy of field paths with output_only field paths removed
   483  func (fieldMask *AttestationDomain_Policy_FieldMask) FilterInputFields() *AttestationDomain_Policy_FieldMask {
   484  	result := &AttestationDomain_Policy_FieldMask{}
   485  	result.Paths = append(result.Paths, fieldMask.Paths...)
   486  	return result
   487  }
   488  
   489  // ToFieldMask is used for proto conversions
   490  func (fieldMask *AttestationDomain_Policy_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   491  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   492  	for _, path := range fieldMask.Paths {
   493  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   494  	}
   495  	return protoFieldMask
   496  }
   497  
   498  func (fieldMask *AttestationDomain_Policy_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   499  	if fieldMask == nil {
   500  		return status.Error(codes.Internal, "target field mask is nil")
   501  	}
   502  	fieldMask.Paths = make([]AttestationDomainPolicy_FieldPath, 0, len(protoFieldMask.Paths))
   503  	for _, strPath := range protoFieldMask.Paths {
   504  		path, err := ParseAttestationDomainPolicy_FieldPath(strPath)
   505  		if err != nil {
   506  			return err
   507  		}
   508  		fieldMask.Paths = append(fieldMask.Paths, path)
   509  	}
   510  	return nil
   511  }
   512  
   513  // implement methods required by customType
   514  func (fieldMask AttestationDomain_Policy_FieldMask) Marshal() ([]byte, error) {
   515  	protoFieldMask := fieldMask.ToProtoFieldMask()
   516  	return proto.Marshal(protoFieldMask)
   517  }
   518  
   519  func (fieldMask *AttestationDomain_Policy_FieldMask) Unmarshal(data []byte) error {
   520  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   521  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   522  		return err
   523  	}
   524  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   525  		return err
   526  	}
   527  	return nil
   528  }
   529  
   530  func (fieldMask *AttestationDomain_Policy_FieldMask) Size() int {
   531  	return proto.Size(fieldMask.ToProtoFieldMask())
   532  }
   533  
   534  func (fieldMask AttestationDomain_Policy_FieldMask) MarshalJSON() ([]byte, error) {
   535  	return json.Marshal(fieldMask.ToProtoFieldMask())
   536  }
   537  
   538  func (fieldMask *AttestationDomain_Policy_FieldMask) UnmarshalJSON(data []byte) error {
   539  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   540  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   541  		return err
   542  	}
   543  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   544  		return err
   545  	}
   546  	return nil
   547  }
   548  
   549  func (fieldMask *AttestationDomain_Policy_FieldMask) AppendPath(path AttestationDomainPolicy_FieldPath) {
   550  	fieldMask.Paths = append(fieldMask.Paths, path)
   551  }
   552  
   553  func (fieldMask *AttestationDomain_Policy_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   554  	fieldMask.Paths = append(fieldMask.Paths, path.(AttestationDomainPolicy_FieldPath))
   555  }
   556  
   557  func (fieldMask *AttestationDomain_Policy_FieldMask) GetPaths() []AttestationDomainPolicy_FieldPath {
   558  	if fieldMask == nil {
   559  		return nil
   560  	}
   561  	return fieldMask.Paths
   562  }
   563  
   564  func (fieldMask *AttestationDomain_Policy_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   565  	if fieldMask == nil {
   566  		return nil
   567  	}
   568  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   569  	for _, path := range fieldMask.Paths {
   570  		rawPaths = append(rawPaths, path)
   571  	}
   572  	return rawPaths
   573  }
   574  
   575  func (fieldMask *AttestationDomain_Policy_FieldMask) SetFromCliFlag(raw string) error {
   576  	path, err := ParseAttestationDomainPolicy_FieldPath(raw)
   577  	if err != nil {
   578  		return err
   579  	}
   580  	fieldMask.Paths = append(fieldMask.Paths, path)
   581  	return nil
   582  }
   583  
   584  func (fieldMask *AttestationDomain_Policy_FieldMask) Set(target, source *AttestationDomain_Policy) {
   585  	for _, path := range fieldMask.Paths {
   586  		val, _ := path.GetSingle(source)
   587  		// if val is nil, then field does not exist in source, skip
   588  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   589  		if val != nil {
   590  			path.WithIValue(val).SetTo(&target)
   591  		}
   592  	}
   593  }
   594  
   595  func (fieldMask *AttestationDomain_Policy_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   596  	fieldMask.Set(target.(*AttestationDomain_Policy), source.(*AttestationDomain_Policy))
   597  }
   598  
   599  func (fieldMask *AttestationDomain_Policy_FieldMask) Project(source *AttestationDomain_Policy) *AttestationDomain_Policy {
   600  	if source == nil {
   601  		return nil
   602  	}
   603  	if fieldMask == nil {
   604  		return source
   605  	}
   606  	result := &AttestationDomain_Policy{}
   607  	expectedPcrsMask := &iam_common.PCR_FieldMask{}
   608  	wholeExpectedPcrsAccepted := false
   609  
   610  	for _, p := range fieldMask.Paths {
   611  		switch tp := p.(type) {
   612  		case *AttestationDomainPolicy_FieldTerminalPath:
   613  			switch tp.selector {
   614  			case AttestationDomainPolicy_FieldPathSelectorManufacturerRootCaCertsPem:
   615  				result.ManufacturerRootCaCertsPem = source.ManufacturerRootCaCertsPem
   616  			case AttestationDomainPolicy_FieldPathSelectorRequireEnrollment:
   617  				result.RequireEnrollment = source.RequireEnrollment
   618  			case AttestationDomainPolicy_FieldPathSelectorVerifyEventLog:
   619  				result.VerifyEventLog = source.VerifyEventLog
   620  			case AttestationDomainPolicy_FieldPathSelectorExpectedPcrs:
   621  				result.ExpectedPcrs = source.ExpectedPcrs
   622  				wholeExpectedPcrsAccepted = true
   623  			}
   624  		case *AttestationDomainPolicy_FieldSubPath:
   625  			switch tp.selector {
   626  			case AttestationDomainPolicy_FieldPathSelectorExpectedPcrs:
   627  				expectedPcrsMask.AppendPath(tp.subPath.(iam_common.PCR_FieldPath))
   628  			}
   629  		}
   630  	}
   631  	if wholeExpectedPcrsAccepted == false && len(expectedPcrsMask.Paths) > 0 {
   632  		for _, sourceItem := range source.GetExpectedPcrs() {
   633  			result.ExpectedPcrs = append(result.ExpectedPcrs, expectedPcrsMask.Project(sourceItem))
   634  		}
   635  	}
   636  	return result
   637  }
   638  
   639  func (fieldMask *AttestationDomain_Policy_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   640  	return fieldMask.Project(source.(*AttestationDomain_Policy))
   641  }
   642  
   643  func (fieldMask *AttestationDomain_Policy_FieldMask) PathsCount() int {
   644  	if fieldMask == nil {
   645  		return 0
   646  	}
   647  	return len(fieldMask.Paths)
   648  }
   649  
   650  type AttestationDomain_EnrolledKey_FieldMask struct {
   651  	Paths []AttestationDomainEnrolledKey_FieldPath
   652  }
   653  
   654  func FullAttestationDomain_EnrolledKey_FieldMask() *AttestationDomain_EnrolledKey_FieldMask {
   655  	res := &AttestationDomain_EnrolledKey_FieldMask{}
   656  	res.Paths = append(res.Paths, &AttestationDomainEnrolledKey_FieldTerminalPath{selector: AttestationDomainEnrolledKey_FieldPathSelectorPubkeyPem})
   657  	res.Paths = append(res.Paths, &AttestationDomainEnrolledKey_FieldTerminalPath{selector: AttestationDomainEnrolledKey_FieldPathSelectorComment})
   658  	return res
   659  }
   660  
   661  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) String() string {
   662  	if fieldMask == nil {
   663  		return "<nil>"
   664  	}
   665  	pathsStr := make([]string, 0, len(fieldMask.Paths))
   666  	for _, path := range fieldMask.Paths {
   667  		pathsStr = append(pathsStr, path.String())
   668  	}
   669  	return strings.Join(pathsStr, ", ")
   670  }
   671  
   672  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) IsFull() bool {
   673  	if fieldMask == nil {
   674  		return false
   675  	}
   676  	presentSelectors := make([]bool, 2)
   677  	for _, path := range fieldMask.Paths {
   678  		if asFinal, ok := path.(*AttestationDomainEnrolledKey_FieldTerminalPath); ok {
   679  			presentSelectors[int(asFinal.selector)] = true
   680  		}
   681  	}
   682  	for _, flag := range presentSelectors {
   683  		if !flag {
   684  			return false
   685  		}
   686  	}
   687  	return true
   688  }
   689  
   690  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) ProtoReflect() preflect.Message {
   691  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   692  		return ParseAttestationDomainEnrolledKey_FieldPath(raw)
   693  	})
   694  }
   695  
   696  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) ProtoMessage() {}
   697  
   698  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) Reset() {
   699  	if fieldMask != nil {
   700  		fieldMask.Paths = nil
   701  	}
   702  }
   703  
   704  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) Subtract(other *AttestationDomain_EnrolledKey_FieldMask) *AttestationDomain_EnrolledKey_FieldMask {
   705  	result := &AttestationDomain_EnrolledKey_FieldMask{}
   706  	removedSelectors := make([]bool, 2)
   707  
   708  	for _, path := range other.GetPaths() {
   709  		switch tp := path.(type) {
   710  		case *AttestationDomainEnrolledKey_FieldTerminalPath:
   711  			removedSelectors[int(tp.selector)] = true
   712  		}
   713  	}
   714  	for _, path := range fieldMask.GetPaths() {
   715  		if !removedSelectors[int(path.Selector())] {
   716  			result.Paths = append(result.Paths, path)
   717  		}
   718  	}
   719  
   720  	if len(result.Paths) == 0 {
   721  		return nil
   722  	}
   723  	return result
   724  }
   725  
   726  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   727  	return fieldMask.Subtract(other.(*AttestationDomain_EnrolledKey_FieldMask))
   728  }
   729  
   730  // FilterInputFields generates copy of field paths with output_only field paths removed
   731  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) FilterInputFields() *AttestationDomain_EnrolledKey_FieldMask {
   732  	result := &AttestationDomain_EnrolledKey_FieldMask{}
   733  	result.Paths = append(result.Paths, fieldMask.Paths...)
   734  	return result
   735  }
   736  
   737  // ToFieldMask is used for proto conversions
   738  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   739  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   740  	for _, path := range fieldMask.Paths {
   741  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   742  	}
   743  	return protoFieldMask
   744  }
   745  
   746  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   747  	if fieldMask == nil {
   748  		return status.Error(codes.Internal, "target field mask is nil")
   749  	}
   750  	fieldMask.Paths = make([]AttestationDomainEnrolledKey_FieldPath, 0, len(protoFieldMask.Paths))
   751  	for _, strPath := range protoFieldMask.Paths {
   752  		path, err := ParseAttestationDomainEnrolledKey_FieldPath(strPath)
   753  		if err != nil {
   754  			return err
   755  		}
   756  		fieldMask.Paths = append(fieldMask.Paths, path)
   757  	}
   758  	return nil
   759  }
   760  
   761  // implement methods required by customType
   762  func (fieldMask AttestationDomain_EnrolledKey_FieldMask) Marshal() ([]byte, error) {
   763  	protoFieldMask := fieldMask.ToProtoFieldMask()
   764  	return proto.Marshal(protoFieldMask)
   765  }
   766  
   767  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) Unmarshal(data []byte) error {
   768  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   769  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   770  		return err
   771  	}
   772  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   773  		return err
   774  	}
   775  	return nil
   776  }
   777  
   778  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) Size() int {
   779  	return proto.Size(fieldMask.ToProtoFieldMask())
   780  }
   781  
   782  func (fieldMask AttestationDomain_EnrolledKey_FieldMask) MarshalJSON() ([]byte, error) {
   783  	return json.Marshal(fieldMask.ToProtoFieldMask())
   784  }
   785  
   786  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) UnmarshalJSON(data []byte) error {
   787  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   788  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   789  		return err
   790  	}
   791  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   792  		return err
   793  	}
   794  	return nil
   795  }
   796  
   797  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) AppendPath(path AttestationDomainEnrolledKey_FieldPath) {
   798  	fieldMask.Paths = append(fieldMask.Paths, path)
   799  }
   800  
   801  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   802  	fieldMask.Paths = append(fieldMask.Paths, path.(AttestationDomainEnrolledKey_FieldPath))
   803  }
   804  
   805  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) GetPaths() []AttestationDomainEnrolledKey_FieldPath {
   806  	if fieldMask == nil {
   807  		return nil
   808  	}
   809  	return fieldMask.Paths
   810  }
   811  
   812  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   813  	if fieldMask == nil {
   814  		return nil
   815  	}
   816  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   817  	for _, path := range fieldMask.Paths {
   818  		rawPaths = append(rawPaths, path)
   819  	}
   820  	return rawPaths
   821  }
   822  
   823  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) SetFromCliFlag(raw string) error {
   824  	path, err := ParseAttestationDomainEnrolledKey_FieldPath(raw)
   825  	if err != nil {
   826  		return err
   827  	}
   828  	fieldMask.Paths = append(fieldMask.Paths, path)
   829  	return nil
   830  }
   831  
   832  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) Set(target, source *AttestationDomain_EnrolledKey) {
   833  	for _, path := range fieldMask.Paths {
   834  		val, _ := path.GetSingle(source)
   835  		// if val is nil, then field does not exist in source, skip
   836  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   837  		if val != nil {
   838  			path.WithIValue(val).SetTo(&target)
   839  		}
   840  	}
   841  }
   842  
   843  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   844  	fieldMask.Set(target.(*AttestationDomain_EnrolledKey), source.(*AttestationDomain_EnrolledKey))
   845  }
   846  
   847  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) Project(source *AttestationDomain_EnrolledKey) *AttestationDomain_EnrolledKey {
   848  	if source == nil {
   849  		return nil
   850  	}
   851  	if fieldMask == nil {
   852  		return source
   853  	}
   854  	result := &AttestationDomain_EnrolledKey{}
   855  
   856  	for _, p := range fieldMask.Paths {
   857  		switch tp := p.(type) {
   858  		case *AttestationDomainEnrolledKey_FieldTerminalPath:
   859  			switch tp.selector {
   860  			case AttestationDomainEnrolledKey_FieldPathSelectorPubkeyPem:
   861  				result.PubkeyPem = source.PubkeyPem
   862  			case AttestationDomainEnrolledKey_FieldPathSelectorComment:
   863  				result.Comment = source.Comment
   864  			}
   865  		}
   866  	}
   867  	return result
   868  }
   869  
   870  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   871  	return fieldMask.Project(source.(*AttestationDomain_EnrolledKey))
   872  }
   873  
   874  func (fieldMask *AttestationDomain_EnrolledKey_FieldMask) PathsCount() int {
   875  	if fieldMask == nil {
   876  		return 0
   877  	}
   878  	return len(fieldMask.Paths)
   879  }