generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Labels
area/code-generationIssues or PRs as related to controllers or docs code generationIssues or PRs as related to controllers or docs code generationarea/resource-referencesIssues or PRs related to resource referencesIssues or PRs related to resource referenceslifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.
Description
Describe the bug
Currently Code-generator is not able to generate resource references for
List of list of References.
Here's a sample code:
func (rm *resourceManager) ClearResolvedReferences(res acktypes.AWSResource) acktypes.AWSResource {
ko := rm.concreteResource(res).ko.DeepCopy()
if ko.Spec.Serverless != nil {
for f0idx, f0iter := range ko.Spec.Serverless.VPCConfigs {
if len(f0iter.SecurityGroupRefs) > 0 {
ko.Spec.Serverless.VPCConfigs.SecurityGroupIDs = nil
}
}
}
if ko.Spec.Serverless != nil {
for f0idx, f0iter := range ko.Spec.Serverless.VPCConfigs {
if len(f0iter.SubnetRefs) > 0 {
ko.Spec.Serverless.VPCConfigs.SubnetIDs = nil
}
}
}
return &resource{ko}
}Steps to reproduce
Sample generator.yaml for kafka-controller:
ClusterV2:
is_arn_primary_key: true
renames:
operations:
CreateClusterV2:
input_fields:
ClusterName: Name
output_fields:
ClusteName: Name
ClusterType: Type
DescribeClusterV2:
input_fields:
output_fields:
ClusterName: Name
ClusterType: Type
fields:
ClusterARN:
is_arn: true
# TODO (michaelhtm) Fix generator of lists of list of references
Serverless.VPCConfigs.SecurityGroupIDs:
references:
service_name: ec2
resource: SecurityGroup
path: Status.ID
Serverless.VPCConfigs.SubnetIDs:
references:
service_name: ec2
resource: SubnetGroup
path: Status.SubnetIDExpected outcome
Successfully generate Any type of references defined in generator.yaml
Here's the correct expected output:
func (rm *resourceManager) ClearResolvedReferences(res acktypes.AWSResource) acktypes.AWSResource {
ko := rm.concreteResource(res).ko.DeepCopy()
if ko.Spec.Serverless != nil {
for f0idx, f0iter := range ko.Spec.Serverless.VPCConfigs {
if len(f0iter.SecurityGroupRefs) > 0 {
ko.Spec.Serverless.VPCConfigs[f0idx].SecurityGroupIDs = nil
}
}
}
if ko.Spec.Serverless != nil {
for f0idx, f0iter := range ko.Spec.Serverless.VPCConfigs {
if len(f0iter.SubnetRefs) > 0 {
ko.Spec.Serverless.VPCConfigs[f0idx].SubnetIDs = nil
}
}
}
return &resource{ko}
}- code-generator version: 0.46.2
- 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 generationarea/resource-referencesIssues or PRs related to resource referencesIssues or PRs related to resource referenceslifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.