Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions templates/pkg/resource/manager.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Comment on lines +132 to +137
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you cannot change this method signature before changing the interface in ACK runtime:

https://github.com/aws-controllers-k8s/runtime/blob/main/pkg/types/aws_resource_manager.go#L61-L63

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR: aws-controllers-k8s/runtime#21 contained changes in runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR summary as: "Returning the latest resource from the Delete() call"

r := rm.concreteResource(res)
if r.ko == nil {
// Should never happen... if it does, it's buggy code.
Expand Down
13 changes: 7 additions & 6 deletions templates/pkg/resource/sdk.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 }}
}

Expand Down