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.9.2"
VERSION ?= "v0.10.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.9.2
github.com/aws-controllers-k8s/runtime v0.10.0
github.com/aws/aws-sdk-go v1.37.10
github.com/dlclark/regexp2 v1.4.0
// pin to v0.1.1 due to release problem with v0.1.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws-controllers-k8s/runtime v0.9.2 h1:53ahm38Cn6DTfQdHNrTgbXmUbCjuKntvhkuWGHkAQ18=
github.com/aws-controllers-k8s/runtime v0.9.2/go.mod h1:kG2WM4JAmLgf67cgZV9IZUkY2DsrUzsaNbmhFMfb05c=
github.com/aws-controllers-k8s/runtime v0.10.0 h1:MPZ4mPeap2mP/EKU6Pk7a7phiBSYaeZ9QJX38OPecXo=
github.com/aws-controllers-k8s/runtime v0.10.0/go.mod h1:kG2WM4JAmLgf67cgZV9IZUkY2DsrUzsaNbmhFMfb05c=
github.com/aws/aws-sdk-go v1.37.10 h1:LRwl+97B4D69Z7tz+eRUxJ1C7baBaIYhgrn5eLtua+Q=
github.com/aws/aws-sdk-go v1.37.10/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down
9 changes: 9 additions & 0 deletions pkg/generate/ack/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ var (
"GoCodeSetResourceIdentifiers": func(r *ackmodel.CRD, sourceVarName string, targetVarName string, indentLevel int) string {
return code.SetResourceIdentifiers(r.Config(), r, sourceVarName, targetVarName, indentLevel)
},
"GoCodeFindLateInitializedFieldNames": func(r *ackmodel.CRD, resVarName string, indentLevel int) string {
return code.FindLateInitializedFieldNames(r.Config(), r, resVarName, indentLevel)
},
"GoCodeLateInitializeFromReadOne": func(r *ackmodel.CRD, sourceResVarName string, targetResVarName string, indentLevel int) string {
return code.LateInitializeFromReadOne(r.Config(), r, sourceResVarName, targetResVarName, indentLevel)
},
"GoCodeIncompleteLateInitialization": func(r *ackmodel.CRD, resVarName string, indentLevel int) string {
return code.IncompleteLateInitialization(r.Config(), r, resVarName, indentLevel)
},
}
)

Expand Down
8 changes: 8 additions & 0 deletions pkg/generate/ack/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ code paths:
* sdk_file_end
* delta_pre_compare
* delta_post_compare
* late_initialize_pre_read_one
* late_initialize_post_read_one

The "pre_build_request" hooks are called BEFORE the call to construct
the Input shape that is used in the API operation and therefore BEFORE
Expand Down Expand Up @@ -102,6 +104,12 @@ compares two resources.
The "delta_post_compare" hooks are called AFTER the generated code that
compares two resources.

The "late_initialize_pre_read_one" hooks are called BEFORE making the
readOne call inside AWSResourceManager.LateInitialize() method

The "late_initialize_post_read_one" hooks are called AFTER making the
readOne call inside AWSResourceManager.LateInitialize() method

*/

// ResourceHookCode returns a string with custom callback code for a resource
Expand Down
4 changes: 4 additions & 0 deletions pkg/generate/ack/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func (frm *fakeRM) Delete(context.Context, acktypes.AWSResource) (acktypes.AWSRe

func (frm *fakeRM) ARNFromName(string) string { return "" }

func (frm *fakeRM) LateInitialize(context.Context, acktypes.AWSResource) (acktypes.AWSResource, error) {
return nil, nil
}

// This test is mostly just a hack to introduce a Go module dependency between
// the ACK runtime library and the code generator. The code generator doesn't
// actually depend on Go code in the ACK runtime, but it *produces* templated
Expand Down
Loading