diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 2b62a5b..cbbb753 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,5 +1,5 @@ ack_generate_info: - build_date: "2023-09-14T23:52:46Z" + build_date: "2023-12-16T08:34:38Z" build_hash: 892f29d00a4c4ad21a2fa32919921de18190979d go_version: go1.21.0 version: v0.27.1 @@ -7,7 +7,7 @@ api_directory_checksum: 4538a2a4e75334bd4ab5ebd8dd9f73b69662d197 api_version: v1alpha1 aws_sdk_go_version: v1.44.93 generator_config_info: - file_checksum: 9eac8d3730cfe212c3a88aa5173b22de93c2d0b7 + file_checksum: c373e8ad8d189318656ef1f90a73a1f3e319bf89 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index d6e1730..d282e43 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -14,6 +14,8 @@ resources: template_path: hooks/queue/sdk_get_attributes_post_set_output.go.tpl sdk_update_pre_build_request: template_path: hooks/queue/sdk_update_pre_build_request.go.tpl + sdk_update_post_build_request: + template_path: hooks/queue/sdk_update_post_build_request.go.tpl fields: DelaySeconds: is_attribute: true diff --git a/generator.yaml b/generator.yaml index d6e1730..d282e43 100644 --- a/generator.yaml +++ b/generator.yaml @@ -14,6 +14,8 @@ resources: template_path: hooks/queue/sdk_get_attributes_post_set_output.go.tpl sdk_update_pre_build_request: template_path: hooks/queue/sdk_update_pre_build_request.go.tpl + sdk_update_post_build_request: + template_path: hooks/queue/sdk_update_post_build_request.go.tpl fields: DelaySeconds: is_attribute: true diff --git a/pkg/resource/queue/sdk.go b/pkg/resource/queue/sdk.go index 31ebfe0..867ce25 100644 --- a/pkg/resource/queue/sdk.go +++ b/pkg/resource/queue/sdk.go @@ -292,6 +292,15 @@ func (rm *resourceManager) sdkUpdate( if err != nil { return nil, err } + // note(Julian-Chu): SetAttributes API without any attributes + // will return MalformedInput(message: End of list found where not expected) error. + // if there are no attributes in the input, + // We need to set minimal one default value, or use customUpdate to skip api call. + if len(input.Attributes) == 0 { + input.Attributes = map[string]*string{ + "DelaySeconds": latest.ko.Spec.DelaySeconds, + } + } // NOTE(jaypipes): SetAttributes calls return a response but they don't // contain any useful information. Instead, below, we'll be returning a diff --git a/templates/hooks/queue/sdk_update_post_build_request.go.tpl b/templates/hooks/queue/sdk_update_post_build_request.go.tpl new file mode 100644 index 0000000..107a249 --- /dev/null +++ b/templates/hooks/queue/sdk_update_post_build_request.go.tpl @@ -0,0 +1,9 @@ + // note(Julian-Chu): SetAttributes API without any attributes + // will return MalformedInput(message: End of list found where not expected) error. + // if there are no attributes in the input, + // We need to set minimal one default value, or use customUpdate to skip api call. + if len(input.Attributes) == 0 { + input.Attributes = map[string]*string{ + "DelaySeconds": latest.ko.Spec.DelaySeconds, + } + }