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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/iam/proto/v1/attestation_domain.proto
     3  // DO NOT EDIT!!!
     4  
     5  package attestation_domain
     6  
     7  import (
     8  	"fmt"
     9  	"sort"
    10  
    11  	"google.golang.org/protobuf/proto"
    12  	googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    13  
    14  	gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
    15  )
    16  
    17  // proto imports
    18  import (
    19  	iam_common "github.com/cloudwan/edgelq-sdk/iam/resources/v1/common"
    20  	project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    21  	meta "github.com/cloudwan/goten-sdk/types/meta"
    22  )
    23  
    24  // ensure the imports are used
    25  var (
    26  	_ = new(fmt.Stringer)
    27  	_ = new(sort.Interface)
    28  
    29  	_ = new(proto.Message)
    30  	_ = googlefieldmaskpb.FieldMask{}
    31  
    32  	_ = new(gotenobject.FieldPath)
    33  )
    34  
    35  // make sure we're using proto imports
    36  var (
    37  	_ = &iam_common.PCR{}
    38  	_ = &project.Project{}
    39  	_ = &meta.Meta{}
    40  )
    41  
    42  func (o *AttestationDomain) GotenObjectExt() {}
    43  
    44  func (o *AttestationDomain) MakeFullFieldMask() *AttestationDomain_FieldMask {
    45  	return FullAttestationDomain_FieldMask()
    46  }
    47  
    48  func (o *AttestationDomain) MakeRawFullFieldMask() gotenobject.FieldMask {
    49  	return FullAttestationDomain_FieldMask()
    50  }
    51  
    52  func (o *AttestationDomain) MakeDiffFieldMask(other *AttestationDomain) *AttestationDomain_FieldMask {
    53  	if o == nil && other == nil {
    54  		return &AttestationDomain_FieldMask{}
    55  	}
    56  	if o == nil || other == nil {
    57  		return FullAttestationDomain_FieldMask()
    58  	}
    59  
    60  	res := &AttestationDomain_FieldMask{}
    61  	if o.GetName().String() != other.GetName().String() {
    62  		res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorName})
    63  	}
    64  	{
    65  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    66  		if subMask.IsFull() {
    67  			res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorMetadata})
    68  		} else {
    69  			for _, subpath := range subMask.Paths {
    70  				res.Paths = append(res.Paths, &AttestationDomain_FieldSubPath{selector: AttestationDomain_FieldPathSelectorMetadata, subPath: subpath})
    71  			}
    72  		}
    73  	}
    74  	if o.GetDisplayName() != other.GetDisplayName() {
    75  		res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorDisplayName})
    76  	}
    77  	if o.GetInsecureSkipManufacturerEkcertVerification() != other.GetInsecureSkipManufacturerEkcertVerification() {
    78  		res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorInsecureSkipManufacturerEkcertVerification})
    79  	}
    80  
    81  	if len(o.GetPolicies()) == len(other.GetPolicies()) {
    82  		for i, lValue := range o.GetPolicies() {
    83  			rValue := other.GetPolicies()[i]
    84  			if len(lValue.MakeDiffFieldMask(rValue).Paths) > 0 {
    85  				res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorPolicies})
    86  				break
    87  			}
    88  		}
    89  	} else {
    90  		res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorPolicies})
    91  	}
    92  
    93  	if len(o.GetEnrollmentList()) == len(other.GetEnrollmentList()) {
    94  		for i, lValue := range o.GetEnrollmentList() {
    95  			rValue := other.GetEnrollmentList()[i]
    96  			if len(lValue.MakeDiffFieldMask(rValue).Paths) > 0 {
    97  				res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorEnrollmentList})
    98  				break
    99  			}
   100  		}
   101  	} else {
   102  		res.Paths = append(res.Paths, &AttestationDomain_FieldTerminalPath{selector: AttestationDomain_FieldPathSelectorEnrollmentList})
   103  	}
   104  	return res
   105  }
   106  
   107  func (o *AttestationDomain) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   108  	return o.MakeDiffFieldMask(other.(*AttestationDomain))
   109  }
   110  
   111  func (o *AttestationDomain) Clone() *AttestationDomain {
   112  	if o == nil {
   113  		return nil
   114  	}
   115  	result := &AttestationDomain{}
   116  	if o.Name == nil {
   117  		result.Name = nil
   118  	} else if data, err := o.Name.ProtoString(); err != nil {
   119  		panic(err)
   120  	} else {
   121  		result.Name = &Name{}
   122  		if err := result.Name.ParseProtoString(data); err != nil {
   123  			panic(err)
   124  		}
   125  	}
   126  	result.Metadata = o.Metadata.Clone()
   127  	result.DisplayName = o.DisplayName
   128  	result.InsecureSkipManufacturerEkcertVerification = o.InsecureSkipManufacturerEkcertVerification
   129  	result.Policies = make([]*AttestationDomain_Policy, len(o.Policies))
   130  	for i, sourceValue := range o.Policies {
   131  		result.Policies[i] = sourceValue.Clone()
   132  	}
   133  	result.EnrollmentList = make([]*AttestationDomain_EnrolledKey, len(o.EnrollmentList))
   134  	for i, sourceValue := range o.EnrollmentList {
   135  		result.EnrollmentList[i] = sourceValue.Clone()
   136  	}
   137  	return result
   138  }
   139  
   140  func (o *AttestationDomain) CloneRaw() gotenobject.GotenObjectExt {
   141  	return o.Clone()
   142  }
   143  
   144  func (o *AttestationDomain) Merge(source *AttestationDomain) {
   145  	if source.GetName() != nil {
   146  		if data, err := source.GetName().ProtoString(); err != nil {
   147  			panic(err)
   148  		} else {
   149  			o.Name = &Name{}
   150  			if err := o.Name.ParseProtoString(data); err != nil {
   151  				panic(err)
   152  			}
   153  		}
   154  	} else {
   155  		o.Name = nil
   156  	}
   157  	if source.GetMetadata() != nil {
   158  		if o.Metadata == nil {
   159  			o.Metadata = new(meta.Meta)
   160  		}
   161  		o.Metadata.Merge(source.GetMetadata())
   162  	}
   163  	o.DisplayName = source.GetDisplayName()
   164  	o.InsecureSkipManufacturerEkcertVerification = source.GetInsecureSkipManufacturerEkcertVerification()
   165  	for _, sourceValue := range source.GetPolicies() {
   166  		exists := false
   167  		for _, currentValue := range o.Policies {
   168  			if proto.Equal(sourceValue, currentValue) {
   169  				exists = true
   170  				break
   171  			}
   172  		}
   173  		if !exists {
   174  			var newDstElement *AttestationDomain_Policy
   175  			if sourceValue != nil {
   176  				newDstElement = new(AttestationDomain_Policy)
   177  				newDstElement.Merge(sourceValue)
   178  			}
   179  			o.Policies = append(o.Policies, newDstElement)
   180  		}
   181  	}
   182  
   183  	for _, sourceValue := range source.GetEnrollmentList() {
   184  		exists := false
   185  		for _, currentValue := range o.EnrollmentList {
   186  			if proto.Equal(sourceValue, currentValue) {
   187  				exists = true
   188  				break
   189  			}
   190  		}
   191  		if !exists {
   192  			var newDstElement *AttestationDomain_EnrolledKey
   193  			if sourceValue != nil {
   194  				newDstElement = new(AttestationDomain_EnrolledKey)
   195  				newDstElement.Merge(sourceValue)
   196  			}
   197  			o.EnrollmentList = append(o.EnrollmentList, newDstElement)
   198  		}
   199  	}
   200  
   201  }
   202  
   203  func (o *AttestationDomain) MergeRaw(source gotenobject.GotenObjectExt) {
   204  	o.Merge(source.(*AttestationDomain))
   205  }
   206  
   207  func (o *AttestationDomain_Policy) GotenObjectExt() {}
   208  
   209  func (o *AttestationDomain_Policy) MakeFullFieldMask() *AttestationDomain_Policy_FieldMask {
   210  	return FullAttestationDomain_Policy_FieldMask()
   211  }
   212  
   213  func (o *AttestationDomain_Policy) MakeRawFullFieldMask() gotenobject.FieldMask {
   214  	return FullAttestationDomain_Policy_FieldMask()
   215  }
   216  
   217  func (o *AttestationDomain_Policy) MakeDiffFieldMask(other *AttestationDomain_Policy) *AttestationDomain_Policy_FieldMask {
   218  	if o == nil && other == nil {
   219  		return &AttestationDomain_Policy_FieldMask{}
   220  	}
   221  	if o == nil || other == nil {
   222  		return FullAttestationDomain_Policy_FieldMask()
   223  	}
   224  
   225  	res := &AttestationDomain_Policy_FieldMask{}
   226  	if o.GetManufacturerRootCaCertsPem() != other.GetManufacturerRootCaCertsPem() {
   227  		res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorManufacturerRootCaCertsPem})
   228  	}
   229  	if o.GetRequireEnrollment() != other.GetRequireEnrollment() {
   230  		res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorRequireEnrollment})
   231  	}
   232  	if o.GetVerifyEventLog() != other.GetVerifyEventLog() {
   233  		res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorVerifyEventLog})
   234  	}
   235  
   236  	if len(o.GetExpectedPcrs()) == len(other.GetExpectedPcrs()) {
   237  		for i, lValue := range o.GetExpectedPcrs() {
   238  			rValue := other.GetExpectedPcrs()[i]
   239  			if len(lValue.MakeDiffFieldMask(rValue).Paths) > 0 {
   240  				res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorExpectedPcrs})
   241  				break
   242  			}
   243  		}
   244  	} else {
   245  		res.Paths = append(res.Paths, &AttestationDomainPolicy_FieldTerminalPath{selector: AttestationDomainPolicy_FieldPathSelectorExpectedPcrs})
   246  	}
   247  	return res
   248  }
   249  
   250  func (o *AttestationDomain_Policy) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   251  	return o.MakeDiffFieldMask(other.(*AttestationDomain_Policy))
   252  }
   253  
   254  func (o *AttestationDomain_Policy) Clone() *AttestationDomain_Policy {
   255  	if o == nil {
   256  		return nil
   257  	}
   258  	result := &AttestationDomain_Policy{}
   259  	result.ManufacturerRootCaCertsPem = o.ManufacturerRootCaCertsPem
   260  	result.RequireEnrollment = o.RequireEnrollment
   261  	result.VerifyEventLog = o.VerifyEventLog
   262  	result.ExpectedPcrs = make([]*iam_common.PCR, len(o.ExpectedPcrs))
   263  	for i, sourceValue := range o.ExpectedPcrs {
   264  		result.ExpectedPcrs[i] = sourceValue.Clone()
   265  	}
   266  	return result
   267  }
   268  
   269  func (o *AttestationDomain_Policy) CloneRaw() gotenobject.GotenObjectExt {
   270  	return o.Clone()
   271  }
   272  
   273  func (o *AttestationDomain_Policy) Merge(source *AttestationDomain_Policy) {
   274  	o.ManufacturerRootCaCertsPem = source.GetManufacturerRootCaCertsPem()
   275  	o.RequireEnrollment = source.GetRequireEnrollment()
   276  	o.VerifyEventLog = source.GetVerifyEventLog()
   277  	for _, sourceValue := range source.GetExpectedPcrs() {
   278  		exists := false
   279  		for _, currentValue := range o.ExpectedPcrs {
   280  			if proto.Equal(sourceValue, currentValue) {
   281  				exists = true
   282  				break
   283  			}
   284  		}
   285  		if !exists {
   286  			var newDstElement *iam_common.PCR
   287  			if sourceValue != nil {
   288  				newDstElement = new(iam_common.PCR)
   289  				newDstElement.Merge(sourceValue)
   290  			}
   291  			o.ExpectedPcrs = append(o.ExpectedPcrs, newDstElement)
   292  		}
   293  	}
   294  
   295  }
   296  
   297  func (o *AttestationDomain_Policy) MergeRaw(source gotenobject.GotenObjectExt) {
   298  	o.Merge(source.(*AttestationDomain_Policy))
   299  }
   300  
   301  func (o *AttestationDomain_EnrolledKey) GotenObjectExt() {}
   302  
   303  func (o *AttestationDomain_EnrolledKey) MakeFullFieldMask() *AttestationDomain_EnrolledKey_FieldMask {
   304  	return FullAttestationDomain_EnrolledKey_FieldMask()
   305  }
   306  
   307  func (o *AttestationDomain_EnrolledKey) MakeRawFullFieldMask() gotenobject.FieldMask {
   308  	return FullAttestationDomain_EnrolledKey_FieldMask()
   309  }
   310  
   311  func (o *AttestationDomain_EnrolledKey) MakeDiffFieldMask(other *AttestationDomain_EnrolledKey) *AttestationDomain_EnrolledKey_FieldMask {
   312  	if o == nil && other == nil {
   313  		return &AttestationDomain_EnrolledKey_FieldMask{}
   314  	}
   315  	if o == nil || other == nil {
   316  		return FullAttestationDomain_EnrolledKey_FieldMask()
   317  	}
   318  
   319  	res := &AttestationDomain_EnrolledKey_FieldMask{}
   320  	if o.GetPubkeyPem() != other.GetPubkeyPem() {
   321  		res.Paths = append(res.Paths, &AttestationDomainEnrolledKey_FieldTerminalPath{selector: AttestationDomainEnrolledKey_FieldPathSelectorPubkeyPem})
   322  	}
   323  	if o.GetComment() != other.GetComment() {
   324  		res.Paths = append(res.Paths, &AttestationDomainEnrolledKey_FieldTerminalPath{selector: AttestationDomainEnrolledKey_FieldPathSelectorComment})
   325  	}
   326  	return res
   327  }
   328  
   329  func (o *AttestationDomain_EnrolledKey) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   330  	return o.MakeDiffFieldMask(other.(*AttestationDomain_EnrolledKey))
   331  }
   332  
   333  func (o *AttestationDomain_EnrolledKey) Clone() *AttestationDomain_EnrolledKey {
   334  	if o == nil {
   335  		return nil
   336  	}
   337  	result := &AttestationDomain_EnrolledKey{}
   338  	result.PubkeyPem = o.PubkeyPem
   339  	result.Comment = o.Comment
   340  	return result
   341  }
   342  
   343  func (o *AttestationDomain_EnrolledKey) CloneRaw() gotenobject.GotenObjectExt {
   344  	return o.Clone()
   345  }
   346  
   347  func (o *AttestationDomain_EnrolledKey) Merge(source *AttestationDomain_EnrolledKey) {
   348  	o.PubkeyPem = source.GetPubkeyPem()
   349  	o.Comment = source.GetComment()
   350  }
   351  
   352  func (o *AttestationDomain_EnrolledKey) MergeRaw(source gotenobject.GotenObjectExt) {
   353  	o.Merge(source.(*AttestationDomain_EnrolledKey))
   354  }