diff --git a/Makefile b/Makefile index 317b9486..00b032e3 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ GO111MODULE=on AWS_SERVICE=$(shell echo $(SERVICE) | tr '[:upper:]' '[:lower:]') # Build ldflags -VERSION ?= "v0.4.0" +VERSION ?= "v0.5.0" GITCOMMIT=$(shell git rev-parse HEAD) BUILDDATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') IMPORT_PATH=github.com/aws-controllers-k8s/code-generator diff --git a/go.mod b/go.mod index 7d92bdeb..dbc96385 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/aws-controllers-k8s/code-generator go 1.14 require ( - github.com/aws-controllers-k8s/runtime v0.4.0 + github.com/aws-controllers-k8s/runtime v0.5.0 github.com/aws/aws-sdk-go v1.37.4 github.com/dlclark/regexp2 v1.4.0 // pin to v0.1.1 due to release problem with v0.1.2 diff --git a/templates/pkg/resource/manager.go.tpl b/templates/pkg/resource/manager.go.tpl index 8c6ef918..aa4fa8c4 100644 --- a/templates/pkg/resource/manager.go.tpl +++ b/templates/pkg/resource/manager.go.tpl @@ -129,11 +129,12 @@ func (rm *resourceManager) Update( } // Delete attempts to destroy the supplied AWSResource in the backend AWS -// service API. +// service API, returning an AWSResource representing the +// resource being deleted (if delete is asynchronous and takes time) func (rm *resourceManager) Delete( ctx context.Context, res acktypes.AWSResource, -) error { +) (acktypes.AWSResource, error) { r := rm.concreteResource(res) if r.ko == nil { // Should never happen... if it does, it's buggy code. diff --git a/templates/pkg/resource/sdk.go.tpl b/templates/pkg/resource/sdk.go.tpl index 9b660b96..74b2d767 100644 --- a/templates/pkg/resource/sdk.go.tpl +++ b/templates/pkg/resource/sdk.go.tpl @@ -125,7 +125,7 @@ func (rm *resourceManager) newCreateRequestPayload( func (rm *resourceManager) sdkDelete( ctx context.Context, r *resource, -) (err error) { +) (latest *resource, err error) { rlog := ackrtlog.FromContext(ctx) exit := rlog.Trace("rm.sdkDelete") defer exit(err) @@ -136,25 +136,26 @@ func (rm *resourceManager) sdkDelete( {{- end }} {{- if $customMethod := .CRD.GetCustomImplementation .CRD.Ops.Delete }} if err = rm.{{ $customMethod }}(ctx, r); err != nil { - return err + return nil, err } {{- end }} input, err := rm.newDeleteRequestPayload(r) if err != nil { - return err + return nil, err } {{- if $hookCode := Hook .CRD "sdk_delete_post_build_request" }} {{ $hookCode }} {{- end }} - _, err = rm.sdkapi.{{ .CRD.Ops.Delete.Name }}WithContext(ctx, input) + var resp {{ .CRD.GetOutputShapeGoType .CRD.Ops.Delete }}; _ = resp; + resp, err = rm.sdkapi.{{ .CRD.Ops.Delete.Name }}WithContext(ctx, input) rm.metrics.RecordAPICall("DELETE", "{{ .CRD.Ops.Delete.Name }}", err) {{- if $hookCode := Hook .CRD "sdk_delete_post_request" }} {{ $hookCode }} {{- end }} - return err + return nil, err {{- else }} // TODO(jaypipes): Figure this out... - return nil + return nil, nil {{ end }} }