generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 272
Open
Labels
area/code-generationIssues or PRs as related to controllers or docs code generationIssues or PRs as related to controllers or docs code generationkind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Describe the bug
When generating code setting the API payload for a field marked as a "union" in the AWS API model the code-generator fails to both properly set Spec field values in API payload. Additionally, the isInterfaceSet variable isn't set to true preventing validation that only one member type of the union is set in the payload. An example of this can be seen in the pipes-controller.
if r.ko.Spec.SourceParameters.ManagedStreamingKafkaParameters.Credentials != nil {
var f7f4f2 svcsdktypes.MSKAccessCredentials
isInterfaceSet := false
if r.ko.Spec.SourceParameters.ManagedStreamingKafkaParameters.Credentials.ClientCertificateTLSAuth != nil {
if isInterfaceSet {
return nil, ackerr.NewTerminalError(fmt.Errorf("can only set one of the members for ClientCertificateTlsAuth"))
}
f7f4f2f0Parent := &svcsdktypes.MSKAccessCredentialsMemberClientCertificateTlsAuth{}
f7f4f2f0Parent.Value = *r.ko.Spec.SourceParameters.ManagedStreamingKafkaParameters.Credentials.ClientCertificateTLSAuth
}
if r.ko.Spec.SourceParameters.ManagedStreamingKafkaParameters.Credentials.SASLSCRAM512Auth != nil {
if isInterfaceSet {
return nil, ackerr.NewTerminalError(fmt.Errorf("can only set one of the members for SaslScram512Auth"))
}
f7f4f2f1Parent := &svcsdktypes.MSKAccessCredentialsMemberSaslScram512Auth{}
f7f4f2f1Parent.Value = *r.ko.Spec.SourceParameters.ManagedStreamingKafkaParameters.Credentials.SASLSCRAM512Auth
}
f7f4.Credentials = f7f4f2
}
Steps to reproduce
- Open terminal in the code-generator directory
- Run
make build-controller SERVICE=pipesto trigger build of controller with a union member - Examine generated output for
newCreateRequestPayloadfunc in thepipes-controller/pkg/resource/pipe/sdk.go
Expected outcome
Generated code should set configured union member to relevant field in the API payload. If multiple union members are set isInterfaceSet should trigger an ACK.Terminal condition.
Environment
N/A
- Kubernetes version
- Using EKS (yes/no), if so version?
- AWS service targeted (S3, RDS, etc.)
Metadata
Metadata
Assignees
Labels
area/code-generationIssues or PRs as related to controllers or docs code generationIssues or PRs as related to controllers or docs code generationkind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.