github.com/cloudwan/edgelq-sdk@v1.15.4/devices/resources/v1/tpm_attestation_cert/tpm_attestation_cert_change.pb.change.go (about)

     1  // Code generated by protoc-gen-goten-resource
     2  // Resource change: TpmAttestationCertChange
     3  // DO NOT EDIT!!!
     4  
     5  package tpm_attestation_cert
     6  
     7  import (
     8  	gotenresource "github.com/cloudwan/goten-sdk/runtime/resource"
     9  )
    10  
    11  // proto imports
    12  import (
    13  	project "github.com/cloudwan/edgelq-sdk/devices/resources/v1/project"
    14  	fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    15  )
    16  
    17  // ensure the imports are used
    18  var (
    19  	_ = new(gotenresource.ListQuery)
    20  )
    21  
    22  // make sure we're using proto imports
    23  var (
    24  	_ = &project.Project{}
    25  	_ = &fieldmaskpb.FieldMask{}
    26  )
    27  
    28  func (c *TpmAttestationCertChange) IsAdd() bool {
    29  	if c == nil {
    30  		return false
    31  	}
    32  	_, ok := c.ChangeType.(*TpmAttestationCertChange_Added_)
    33  	return ok
    34  }
    35  
    36  func (c *TpmAttestationCertChange) IsModify() bool {
    37  	if c == nil {
    38  		return false
    39  	}
    40  	_, ok := c.ChangeType.(*TpmAttestationCertChange_Modified_)
    41  	return ok
    42  }
    43  
    44  func (c *TpmAttestationCertChange) IsCurrent() bool {
    45  	if c == nil {
    46  		return false
    47  	}
    48  	_, ok := c.ChangeType.(*TpmAttestationCertChange_Current_)
    49  	return ok
    50  }
    51  
    52  func (c *TpmAttestationCertChange) IsDelete() bool {
    53  	if c == nil {
    54  		return false
    55  	}
    56  	_, ok := c.ChangeType.(*TpmAttestationCertChange_Removed_)
    57  	return ok
    58  }
    59  
    60  func (c *TpmAttestationCertChange) GetCurrentViewIndex() int32 {
    61  	switch cType := c.ChangeType.(type) {
    62  	case *TpmAttestationCertChange_Added_:
    63  		return cType.Added.ViewIndex
    64  	case *TpmAttestationCertChange_Modified_:
    65  		return cType.Modified.ViewIndex
    66  	}
    67  	return 0
    68  }
    69  
    70  func (c *TpmAttestationCertChange) GetPreviousViewIndex() int32 {
    71  	switch cType := c.ChangeType.(type) {
    72  	case *TpmAttestationCertChange_Removed_:
    73  		return cType.Removed.ViewIndex
    74  	case *TpmAttestationCertChange_Modified_:
    75  		return cType.Modified.PreviousViewIndex
    76  	}
    77  	return 0
    78  }
    79  
    80  func (c *TpmAttestationCertChange) GetTpmAttestationCert() *TpmAttestationCert {
    81  	if c == nil {
    82  		return nil
    83  	}
    84  	switch cType := c.ChangeType.(type) {
    85  	case *TpmAttestationCertChange_Added_:
    86  		return cType.Added.TpmAttestationCert
    87  	case *TpmAttestationCertChange_Modified_:
    88  		return cType.Modified.TpmAttestationCert
    89  	case *TpmAttestationCertChange_Current_:
    90  		return cType.Current.TpmAttestationCert
    91  	case *TpmAttestationCertChange_Removed_:
    92  		return nil
    93  	}
    94  	return nil
    95  }
    96  
    97  func (c *TpmAttestationCertChange) GetRawResource() gotenresource.Resource {
    98  	return c.GetTpmAttestationCert()
    99  }
   100  
   101  func (c *TpmAttestationCertChange) GetTpmAttestationCertName() *Name {
   102  	if c == nil {
   103  		return nil
   104  	}
   105  	switch cType := c.ChangeType.(type) {
   106  	case *TpmAttestationCertChange_Added_:
   107  		return cType.Added.TpmAttestationCert.GetName()
   108  	case *TpmAttestationCertChange_Modified_:
   109  		return cType.Modified.Name
   110  	case *TpmAttestationCertChange_Current_:
   111  		return cType.Current.TpmAttestationCert.GetName()
   112  	case *TpmAttestationCertChange_Removed_:
   113  		return cType.Removed.Name
   114  	}
   115  	return nil
   116  }
   117  
   118  func (c *TpmAttestationCertChange) GetRawName() gotenresource.Name {
   119  	return c.GetTpmAttestationCertName()
   120  }
   121  
   122  func (c *TpmAttestationCertChange) SetAddedRaw(snapshot gotenresource.Resource, idx int) {
   123  	c.ChangeType = &TpmAttestationCertChange_Added_{
   124  		Added: &TpmAttestationCertChange_Added{
   125  			TpmAttestationCert: snapshot.(*TpmAttestationCert),
   126  			ViewIndex:          int32(idx),
   127  		},
   128  	}
   129  }
   130  
   131  func (c *TpmAttestationCertChange) SetModifiedRaw(name gotenresource.Name, snapshot gotenresource.Resource, prevIdx int, newIdx int) {
   132  	c.ChangeType = &TpmAttestationCertChange_Modified_{
   133  		Modified: &TpmAttestationCertChange_Modified{
   134  			Name:               name.(*Name),
   135  			TpmAttestationCert: snapshot.(*TpmAttestationCert),
   136  			PreviousViewIndex:  int32(prevIdx),
   137  			ViewIndex:          int32(newIdx),
   138  		},
   139  	}
   140  }
   141  
   142  func (c *TpmAttestationCertChange) SetCurrentRaw(snapshot gotenresource.Resource) {
   143  	c.ChangeType = &TpmAttestationCertChange_Current_{
   144  		Current: &TpmAttestationCertChange_Current{
   145  			TpmAttestationCert: snapshot.(*TpmAttestationCert),
   146  		},
   147  	}
   148  }
   149  
   150  func (c *TpmAttestationCertChange) SetDeletedRaw(name gotenresource.Name, idx int) {
   151  	c.ChangeType = &TpmAttestationCertChange_Removed_{
   152  		Removed: &TpmAttestationCertChange_Removed{
   153  			Name:      name.(*Name),
   154  			ViewIndex: int32(idx),
   155  		},
   156  	}
   157  }