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

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/iam/proto/v1alpha2/attestation_domain.proto
     3  // DO NOT EDIT!!!
     4  
     5  package attestation_domain
     6  
     7  import (
     8  	"bytes"
     9  	"errors"
    10  	"fmt"
    11  	"net"
    12  	"net/url"
    13  	"regexp"
    14  	"strings"
    15  	"time"
    16  	"unicode/utf8"
    17  
    18  	gotenvalidate "github.com/cloudwan/goten-sdk/runtime/validate"
    19  )
    20  
    21  // proto imports
    22  import (
    23  	iam_common "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/common"
    24  	project "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/project"
    25  	meta "github.com/cloudwan/goten-sdk/types/meta"
    26  )
    27  
    28  var (
    29  	_ = bytes.Equal
    30  	_ = errors.New
    31  	_ = fmt.Errorf
    32  	_ = net.ParseIP
    33  	_ = regexp.Match
    34  	_ = strings.Split
    35  	_ = time.Now
    36  	_ = utf8.RuneCountInString
    37  	_ = url.Parse
    38  	_ = gotenvalidate.NewValidationError
    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  func (obj *AttestationDomain) GotenValidate() error {
    49  	if obj == nil {
    50  		return nil
    51  	}
    52  	if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok {
    53  		if err := subobj.GotenValidate(); err != nil {
    54  			return gotenvalidate.NewValidationError("AttestationDomain", "metadata", obj.Metadata, "nested object validation failed", err)
    55  		}
    56  	}
    57  	for idx, elem := range obj.Policies {
    58  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    59  			if err := subobj.GotenValidate(); err != nil {
    60  				return gotenvalidate.NewValidationError("AttestationDomain", "policies", obj.Policies[idx], "nested object validation failed", err)
    61  			}
    62  		}
    63  	}
    64  	for idx, elem := range obj.EnrollmentList {
    65  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    66  			if err := subobj.GotenValidate(); err != nil {
    67  				return gotenvalidate.NewValidationError("AttestationDomain", "enrollmentList", obj.EnrollmentList[idx], "nested object validation failed", err)
    68  			}
    69  		}
    70  	}
    71  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    72  		return cvobj.GotenCustomValidate()
    73  	}
    74  	return nil
    75  }
    76  func (obj *AttestationDomain_Policy) GotenValidate() error {
    77  	if obj == nil {
    78  		return nil
    79  	}
    80  	if err := gotenvalidate.ValidatePEM(string(obj.ManufacturerRootCaCertsPem)); err != nil {
    81  		return gotenvalidate.NewValidationError("Policy", "manufacturerRootCaCertsPem", obj.ManufacturerRootCaCertsPem, "field must contain a valid PEM encoded primitive", err)
    82  	}
    83  	for idx, elem := range obj.ExpectedPcrs {
    84  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    85  			if err := subobj.GotenValidate(); err != nil {
    86  				return gotenvalidate.NewValidationError("Policy", "expectedPcrs", obj.ExpectedPcrs[idx], "nested object validation failed", err)
    87  			}
    88  		}
    89  	}
    90  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    91  		return cvobj.GotenCustomValidate()
    92  	}
    93  	return nil
    94  }
    95  func (obj *AttestationDomain_EnrolledKey) GotenValidate() error {
    96  	if obj == nil {
    97  		return nil
    98  	}
    99  	if err := gotenvalidate.ValidatePEM(string(obj.PubkeyPem)); err != nil {
   100  		return gotenvalidate.NewValidationError("EnrolledKey", "pubkeyPem", obj.PubkeyPem, "field must contain a valid PEM encoded primitive", err)
   101  	}
   102  	if obj.PubkeyPem == "" {
   103  		return gotenvalidate.NewValidationError("EnrolledKey", "pubkeyPem", obj.PubkeyPem, "field is required", nil)
   104  	}
   105  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   106  		return cvobj.GotenCustomValidate()
   107  	}
   108  	return nil
   109  }