You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
include Spec fields in GetAttributes SetResource (#380)
Attempting to generate the SNS controller with code-generator <=
v0.21.0 results in various `make test` failures that look like this:
```
[jaypipes@thelio sns-controller]$ make test
go test -v ./...
? github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1 [no test files]
pkg/resource/topic/sdk.go:225:8: undefined: err
pkg/resource/platform_application/sdk.go:75:6: resp declared but not used
pkg/resource/platform_application/sdk.go:217:8: undefined: err
pkg/resource/platform_endpoint/sdk.go:75:6: resp declared but not used
pkg/resource/platform_endpoint/sdk.go:113:48: r.ko.Spec.EndpointARN undefined (type "github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1".PlatformEndpointSpec has no field or method EndpointARN)
pkg/resource/platform_endpoint/sdk.go:202:8: undefined: err
pkg/resource/platform_endpoint/sdk.go:270:48: r.ko.Spec.EndpointARN undefined (type "github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1".PlatformEndpointSpec has no field or method EndpointARN)
make: *** [Makefile:19: test] Error 2
```
We were not including Spec fields in the processing of
SetResourceGetAttributes, which resulted in a bunch of `resp variable
declared and not used` compile-time failures. This patch fixes that by
pulling attributes from the resulting Attributes map into Spec fields
when the field is_read_only=false.
In addition, fixes the template for sdk_update_set_attributes to declare
an `err` variable before referencing it.
Signed-off-by: Jay Pipes <[email protected]>
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
0 commit comments