@@ -157,6 +157,13 @@ func (r *accountREST) Create(ctx context.Context, obj runtime.Object, createVali
157157 if ! ok {
158158 return nil , fmt .Errorf ("not an account: %#v" , obj )
159159 }
160+ if createValidation != nil {
161+ err := createValidation (ctx , account )
162+ if err != nil {
163+ return nil , err
164+ }
165+ }
166+
160167 configAccount , err := ConvertTenancyAccount (account )
161168 if err != nil {
162169 return nil , err
@@ -189,6 +196,19 @@ func (r *accountREST) Update(ctx context.Context, name string, objInfo rest.Upda
189196 return nil , false , fmt .Errorf ("New object is not an account" )
190197 }
191198
199+ if createValidation != nil {
200+ err := createValidation (ctx , newAccount )
201+ if err != nil {
202+ return nil , false , err
203+ }
204+ }
205+ if updateValidation != nil {
206+ err := updateValidation (ctx , newAccount , oldObj )
207+ if err != nil {
208+ return nil , false , err
209+ }
210+ }
211+
192212 newConfigAccount , err := ConvertTenancyAccount (newAccount )
193213 if err != nil {
194214 return nil , false , err
@@ -213,6 +233,17 @@ func (r *accountREST) Delete(ctx context.Context, name string, deleteValidation
213233 return nil , false , err
214234 }
215235
236+ account , err := ConvertConfigAccount (configAccount )
237+ if err != nil {
238+ return nil , false , err
239+ }
240+ if deleteValidation != nil {
241+ err = deleteValidation (ctx , account )
242+ if err != nil {
243+ return nil , false , err
244+ }
245+ }
246+
216247 // we have to use a background context here, because it might
217248 // be possible that the user is cancelling the request and we want
218249 // to fully delete the account and its children
@@ -223,7 +254,7 @@ func (r *accountREST) Delete(ctx context.Context, name string, deleteValidation
223254 return nil , false , err
224255 }
225256
226- account , err : = ConvertConfigAccount (configAccount )
257+ account , err = ConvertConfigAccount (configAccount )
227258 if err != nil {
228259 return nil , false , err
229260 }
0 commit comments