Commit 39d7c30
authored
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 <jaypipes@gmail.com>
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent 12246c7 commit 39d7c30
File tree
3 files changed
+27
-10
lines changed- pkg/generate/code
- templates/pkg/resource
3 files changed
+27
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
796 | | - | |
797 | 796 | | |
798 | 797 | | |
799 | 798 | | |
| |||
806 | 805 | | |
807 | 806 | | |
808 | 807 | | |
| 808 | + | |
809 | 809 | | |
810 | 810 | | |
811 | 811 | | |
| |||
850 | 850 | | |
851 | 851 | | |
852 | 852 | | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
| 853 | + | |
| 854 | + | |
862 | 855 | | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
863 | 864 | | |
864 | 865 | | |
865 | 866 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2712 | 2712 | | |
2713 | 2713 | | |
2714 | 2714 | | |
| 2715 | + | |
| 2716 | + | |
2715 | 2717 | | |
| 2718 | + | |
2716 | 2719 | | |
2717 | 2720 | | |
2718 | 2721 | | |
2719 | 2722 | | |
2720 | 2723 | | |
| 2724 | + | |
2721 | 2725 | | |
2722 | 2726 | | |
2723 | 2727 | | |
| |||
2766 | 2770 | | |
2767 | 2771 | | |
2768 | 2772 | | |
| 2773 | + | |
2769 | 2774 | | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
2770 | 2779 | | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
2771 | 2783 | | |
2772 | 2784 | | |
2773 | 2785 | | |
2774 | 2786 | | |
2775 | 2787 | | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
2776 | 2791 | | |
2777 | 2792 | | |
2778 | 2793 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments