github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1alpha2/service_account/service_account_change.pb.change.go (about) 1 // Code generated by protoc-gen-goten-resource 2 // Resource change: ServiceAccountChange 3 // DO NOT EDIT!!! 4 5 package service_account 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/iam/resources/v1alpha2/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 *ServiceAccountChange) IsAdd() bool { 29 if c == nil { 30 return false 31 } 32 _, ok := c.ChangeType.(*ServiceAccountChange_Added_) 33 return ok 34 } 35 36 func (c *ServiceAccountChange) IsModify() bool { 37 if c == nil { 38 return false 39 } 40 _, ok := c.ChangeType.(*ServiceAccountChange_Modified_) 41 return ok 42 } 43 44 func (c *ServiceAccountChange) IsCurrent() bool { 45 if c == nil { 46 return false 47 } 48 _, ok := c.ChangeType.(*ServiceAccountChange_Current_) 49 return ok 50 } 51 52 func (c *ServiceAccountChange) IsDelete() bool { 53 if c == nil { 54 return false 55 } 56 _, ok := c.ChangeType.(*ServiceAccountChange_Removed_) 57 return ok 58 } 59 60 func (c *ServiceAccountChange) GetCurrentViewIndex() int32 { 61 switch cType := c.ChangeType.(type) { 62 case *ServiceAccountChange_Added_: 63 return cType.Added.ViewIndex 64 case *ServiceAccountChange_Modified_: 65 return cType.Modified.ViewIndex 66 } 67 return 0 68 } 69 70 func (c *ServiceAccountChange) GetPreviousViewIndex() int32 { 71 switch cType := c.ChangeType.(type) { 72 case *ServiceAccountChange_Removed_: 73 return cType.Removed.ViewIndex 74 case *ServiceAccountChange_Modified_: 75 return cType.Modified.PreviousViewIndex 76 } 77 return 0 78 } 79 80 func (c *ServiceAccountChange) GetServiceAccount() *ServiceAccount { 81 if c == nil { 82 return nil 83 } 84 switch cType := c.ChangeType.(type) { 85 case *ServiceAccountChange_Added_: 86 return cType.Added.ServiceAccount 87 case *ServiceAccountChange_Modified_: 88 return cType.Modified.ServiceAccount 89 case *ServiceAccountChange_Current_: 90 return cType.Current.ServiceAccount 91 case *ServiceAccountChange_Removed_: 92 return nil 93 } 94 return nil 95 } 96 97 func (c *ServiceAccountChange) GetRawResource() gotenresource.Resource { 98 return c.GetServiceAccount() 99 } 100 101 func (c *ServiceAccountChange) GetServiceAccountName() *Name { 102 if c == nil { 103 return nil 104 } 105 switch cType := c.ChangeType.(type) { 106 case *ServiceAccountChange_Added_: 107 return cType.Added.ServiceAccount.GetName() 108 case *ServiceAccountChange_Modified_: 109 return cType.Modified.Name 110 case *ServiceAccountChange_Current_: 111 return cType.Current.ServiceAccount.GetName() 112 case *ServiceAccountChange_Removed_: 113 return cType.Removed.Name 114 } 115 return nil 116 } 117 118 func (c *ServiceAccountChange) GetRawName() gotenresource.Name { 119 return c.GetServiceAccountName() 120 } 121 122 func (c *ServiceAccountChange) SetAddedRaw(snapshot gotenresource.Resource, idx int) { 123 c.ChangeType = &ServiceAccountChange_Added_{ 124 Added: &ServiceAccountChange_Added{ 125 ServiceAccount: snapshot.(*ServiceAccount), 126 ViewIndex: int32(idx), 127 }, 128 } 129 } 130 131 func (c *ServiceAccountChange) SetModifiedRaw(name gotenresource.Name, snapshot gotenresource.Resource, prevIdx int, newIdx int) { 132 c.ChangeType = &ServiceAccountChange_Modified_{ 133 Modified: &ServiceAccountChange_Modified{ 134 Name: name.(*Name), 135 ServiceAccount: snapshot.(*ServiceAccount), 136 PreviousViewIndex: int32(prevIdx), 137 ViewIndex: int32(newIdx), 138 }, 139 } 140 } 141 142 func (c *ServiceAccountChange) SetCurrentRaw(snapshot gotenresource.Resource) { 143 c.ChangeType = &ServiceAccountChange_Current_{ 144 Current: &ServiceAccountChange_Current{ 145 ServiceAccount: snapshot.(*ServiceAccount), 146 }, 147 } 148 } 149 150 func (c *ServiceAccountChange) SetDeletedRaw(name gotenresource.Name, idx int) { 151 c.ChangeType = &ServiceAccountChange_Removed_{ 152 Removed: &ServiceAccountChange_Removed{ 153 Name: name.(*Name), 154 ViewIndex: int32(idx), 155 }, 156 } 157 }