@@ -160,10 +160,14 @@ func (e *external) Delete(ctx context.Context, mg cpresource.Managed) error {
160
160
cr.Status.SetConditions(xpv1.Deleting())
161
161
{ {- if .CRD.Ops.Delete } }
162
162
input := Generate{ { .CRD.Ops.Delete.InputRef.Shape.ShapeName } }(cr)
163
- if err := e.preDelete(ctx, cr, input); err != nil {
163
+ ignore, err := e.preDelete(ctx, cr, input)
164
+ if err != nil {
164
165
return errors.Wrap(err, " pre-delete failed" )
165
166
}
166
- _, err := e.client.{ { .CRD.Ops.Delete.Name } }WithContext(ctx, input)
167
+ if ignore {
168
+ return nil
169
+ }
170
+ _, err = e.client.{ { .CRD.Ops.Delete.Name } }WithContext(ctx, input)
167
171
return awsclient.Wrap(cpresource.Ignore(IsNotFound, err), errDelete)
168
172
{ {- else } }
169
173
return e.delete(ctx, mg)
@@ -224,29 +228,30 @@ type external struct {
224
228
lateInitialize func(*svcapitypes.{ { .CRD.Names.Camel } }Parameters, *svcsdk.{ { .CRD.Ops.ReadMany.OutputRef.Shape.ShapeName } }) error
225
229
isUpToDate func(*svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.ReadMany.OutputRef.Shape.ShapeName } }) (bool, error)
226
230
{ {- else } }
227
- observe func(ctx context.Context, mg cpresource.Managed) (managed.ExternalObservation, error)
231
+ observe func(context.Context, cpresource.Managed) (managed.ExternalObservation, error)
228
232
{ {- end } }
229
233
preCreate func(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Create.InputRef.Shape.ShapeName } }) error
230
234
postCreate func(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Create.OutputRef.Shape.ShapeName } }, managed.ExternalCreation, error) (managed.ExternalCreation, error)
231
235
{ {- if .CRD.Ops.Delete } }
232
- preDelete func(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Delete.InputRef.Shape.ShapeName } }) error
236
+ preDelete func(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Delete.InputRef.Shape.ShapeName } }) (bool, error)
233
237
{ {- else } }
234
- delete func(ctx context.Context, mg cpresource.Managed) error
238
+ delete func(context.Context, cpresource.Managed) error
235
239
{ {- end } }
236
240
{ {- if .CRD.Ops.Update } }
237
241
preUpdate func(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Update.InputRef.Shape.ShapeName } }) error
238
242
postUpdate func(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Update.OutputRef.Shape.ShapeName } }, managed.ExternalUpdate, error) (managed.ExternalUpdate, error)
239
243
{ {- else } }
240
- update func(ctx context.Context, mg cpresource.Managed) (managed.ExternalUpdate, error)
244
+ update func(context.Context, cpresource.Managed) (managed.ExternalUpdate, error)
241
245
{ { end } }
242
246
}
243
247
244
248
{ {- if .CRD.Ops.ReadOne } }
245
249
func nopPreObserve(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.ReadOne.InputRef.Shape.ShapeName } }) error {
246
250
return nil
247
251
}
248
- func nopPostObserve(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.ReadOne.OutputRef.Shape.ShapeName } }, managed.ExternalObservation, error) (managed.ExternalObservation, error) {
249
- return managed.ExternalObservation{} , nil
252
+
253
+ func nopPostObserve(_ context.Context, _ *svcapitypes.{ { .CRD.Names.Camel } }, _ *svcsdk.{ { .CRD.Ops.ReadOne.OutputRef.Shape.ShapeName } }, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) {
254
+ return obs, err
250
255
}
251
256
func nopLateInitialize(*svcapitypes.{ { .CRD.Names.Camel } }Parameters, *svcsdk.{ { .CRD.Ops.ReadOne.OutputRef.Shape.ShapeName } }) error {
252
257
return nil
@@ -258,8 +263,9 @@ func alwaysUpToDate(*svcapitypes.{{ .CRD.Names.Camel }}, *svcsdk.{{ .CRD.Ops.Rea
258
263
func nopPreObserve(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.GetAttributes.InputRef.Shape.ShapeName } }) error {
259
264
return nil
260
265
}
261
- func nopPostObserve(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.GetAttributes.OutputRef.Shape.ShapeName } }, managed.ExternalObservation, error) (managed.ExternalObservation, error) {
262
- return managed.ExternalObservation{} , nil
266
+
267
+ func nopPostObserve(_ context.Context, _ *svcapitypes.{ { .CRD.Names.Camel } }, _ *svcsdk.{ { .CRD.Ops.GetAttributes.OutputRef.Shape.ShapeName } }, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) {
268
+ return obs, err
263
269
}
264
270
func nopLateInitialize(*svcapitypes.{ { .CRD.Names.Camel } }Parameters, *svcsdk.{ { .CRD.Ops.GetAttributes.OutputRef.Shape.ShapeName } }) error {
265
271
return nil
@@ -271,8 +277,8 @@ func alwaysUpToDate(*svcapitypes.{{ .CRD.Names.Camel }}, *svcsdk.{{ .CRD.Ops.Get
271
277
func nopPreObserve(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.ReadMany.InputRef.Shape.ShapeName } }) error {
272
278
return nil
273
279
}
274
- func nopPostObserve(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.ReadMany.OutputRef.Shape.ShapeName } }, managed.ExternalObservation, error) (managed.ExternalObservation, error) {
275
- return managed.ExternalObservation{ } , nil
280
+ func nopPostObserve(_ context.Context, _ *svcapitypes.{ { .CRD.Names.Camel } }, _ *svcsdk.{ { .CRD.Ops.ReadMany.OutputRef.Shape.ShapeName } }, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) {
281
+ return obs, err
276
282
}
277
283
func nopFilterList(_ *svcapitypes.{ { .CRD.Names.Camel } }, list *svcsdk.{ { .CRD.Ops.ReadMany.OutputRef.Shape.ShapeName } }) *svcsdk.{ { .CRD.Ops.ReadMany.OutputRef.Shape.ShapeName } } {
278
284
return list
@@ -293,12 +299,12 @@ func nopObserve(context.Context, cpresource.Managed) (managed.ExternalObservatio
293
299
func nopPreCreate(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Create.InputRef.Shape.ShapeName } }) error {
294
300
return nil
295
301
}
296
- func nopPostCreate(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Create.OutputRef.Shape.ShapeName } }, managed.ExternalCreation, error) (managed.ExternalCreation, error) {
297
- return managed.ExternalCreation{ } , nil
302
+ func nopPostCreate(_ context.Context, _ *svcapitypes.{ { .CRD.Names.Camel } }, _ *svcsdk.{ { .CRD.Ops.Create.OutputRef.Shape.ShapeName } }, cre managed.ExternalCreation, err error) (managed.ExternalCreation, error) {
303
+ return cre, err
298
304
}
299
305
{ {- if .CRD.Ops.Delete } }
300
- func nopPreDelete(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Delete.InputRef.Shape.ShapeName } }) error {
301
- return nil
306
+ func nopPreDelete(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Delete.InputRef.Shape.ShapeName } }) (bool, error) {
307
+ return false , nil
302
308
}
303
309
{ {- else } }
304
310
func nopDelete(context.Context, cpresource.Managed) error {
@@ -309,8 +315,8 @@ func nopDelete(context.Context, cpresource.Managed) error {
309
315
func nopPreUpdate(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Update.InputRef.Shape.ShapeName } }) error {
310
316
return nil
311
317
}
312
- func nopPostUpdate(context.Context, *svcapitypes.{ { .CRD.Names.Camel } }, *svcsdk.{ { .CRD.Ops.Update.OutputRef.Shape.ShapeName } }, managed.ExternalUpdate, error) (managed.ExternalUpdate, error) {
313
- return managed.ExternalUpdate{ } , nil
318
+ func nopPostUpdate(_ context.Context, _ *svcapitypes.{ { .CRD.Names.Camel } }, _ *svcsdk.{ { .CRD.Ops.Update.OutputRef.Shape.ShapeName } }, upd managed.ExternalUpdate, err error) (managed.ExternalUpdate, error) {
319
+ return upd, err
314
320
}
315
321
{ {- else } }
316
322
func nopUpdate(context.Context, cpresource.Managed) (managed.ExternalUpdate, error) {
0 commit comments