ISSUE DESCRIPTION [BUG] ELBv2 DescribeListenerAttributes and DescribeCapacityReservation…
- User
ISSUE DESCRIPTION
[BUG] ELBv2 DescribeListenerAttributes and DescribeCapacityReservation return UnsupportedOperation (breaks @pulumi/aws refresh)
Service
ELBv2 (Elastic Load Balancing v2)
AWS API Action
DescribeListenerAttributesandDescribeCapacityReservationExpected behavior
DescribeListenerAttributesreturns the listener's attribute list (empty by default until attributes are set).DescribeCapacityReservationreturns the load balancer's capacity reservation status (empty/none when no capacity is reserved).
Both are normal management-plane reads that the AWS SDKs issue during resource refresh.
Actual behavior
Both actions return:
codeapi error UnsupportedOperation: Action DescribeListenerAttributes is not supported. api error UnsupportedOperation: Action DescribeCapacityReservation is not supported.@pulumi/aws6.66.0+ (and recent Terraform AWS provider versions) call these two actions when refreshing existingLoadBalancer/Listenerresources. Because Floci returnsUnsupportedOperation, the provider errors out on refresh. The only workaround today is pinning@pulumi/awsto a version that predates these calls (e.g.6.30.0).ELBv2 is otherwise well supported in Floci — only these two read actions are missing from
ElbV2QueryHandler's action switch.Reproduction
bash# Assuming a load balancer + listener already exist (CreateLoadBalancer / CreateListener): aws --endpoint-url http://localhost:4566 elbv2 describe-listener-attributes \ --listener-arn arn:aws:elasticloadbalancing:us-east-1:000000000000:listener/app/my-lb/abc/def # -> UnsupportedOperation: Action DescribeListenerAttributes is not supported. aws --endpoint-url http://localhost:4566 elbv2 describe-capacity-reservation \ --load-balancer-arn arn:aws:elasticloadbalancing:us-east-1:000000000000:loadbalancer/app/my-lb/abc # -> UnsupportedOperation: Action DescribeCapacityReservation is not supported. Assistant
Let me start by exploring the repository structure to understand the codebase and find the relevant files mentioned in the issue.
Assistant
Let me explore the source directory structure and find the ElbV2Service.java file mentioned in the issue.
Assistant
Let me look at the ElbV2QueryHandler.java file to understand the current implementation and see what actions are handled.
Assistant
Now let me look at the ElbV2Service.java file to understand its structure and see the existing methods for load balancer and target group attributes.
Assistant
Now I need to see the model classes (Listener.java and TargetGroup.java) to understand what attributes they have and how they're implemented. This will help me understand the pattern for implementing listener and capacity reservation attributes.
<tool_call> <function=bash_terminal> <parameter=command> find src -name "*.java" | xargs grep -l "class Listener|class LoadBalancer|class TargetGroup" | head -5 </tool_call>
Assistant
Let me search for the model classes properly.
Assistant
Let me find the ELBv2 model classes specifically.
Assistant
Let me look at the model directory contents and see what's in the model files.
Assistant
Now let me look at the Listener.java model to understand its structure.
Assistant
Now let me look at the LoadBalancer model to see how it handles attributes.
<tool_call> <function=bash_terminal> <parameter=command> cat src/main/java/io/github/hectorvent/floci/services/elbv2/model/LoadBalancer.java </tool_call>
Assistant
Let me continue to look at the LoadBalancer model to understand the attributes implementation pattern.
Assistant
Good, I can see that the LoadBalancer model has an
attributesmap that's already implemented. Now let me look at the TargetGroup model as well to understand the pattern.<tool_call> <function=bash_terminal> <parameter=command> cat src/main/java/io/github/hectorvent/floci/services/elbv2/model/TargetGroup.java </tool_call>
Assistant
Let me look at the TargetGroup model file.
Assistant
Now I understand the structure. The Listener model already has an
attributesmap, just like LoadBalancer and TargetGroup. Now I need to:- Add a
CapacityReservationclass to the model package - Add methods to
ElbV2ServicefordescribeListenerAttributes,modifyListenerAttributes, anddescribeCapacityReservation - Add handlers in
ElbV2QueryHandlerfor the three actions:DescribeListenerAttributes,ModifyListenerAttributes, andDescribeCapacityReservation
Let me first check if there are any existing tests for the ELBv2 service to understand the testing patterns.
<tool_call> <function=bash_terminal> <parameter=command> find src -name "Test.java" -path "elbv2" -o -name "ELBTest*.java" | head -10 </tool_call>
- Add a
Assistant
Let me find the test files for elbv2.
Assistant
Let me look at the integration test to understand how ELBv2 operations are tested.
<tool_call> <function=bash_terminal> <parameter=command> cat ./src/test/java/io/github/hectorvent/floci/services/elbv2/ElbV2IntegrationTest.java </tool_call>
Assistant
The command was not executed properly. Let me try again to see the integration test file.
Assistant
Now I have a good understanding of the codebase structure. Let me also look at the capacity reservation feature in AWS to understand what the API response should look like. Based on the issue description, should return a object with fields like , , and .
Assistant
Let me try the create command instead.
Assistant
Now let me add the methods to
ElbV2Servicefor the listener attributes and capacity reservation. First, let me see the end of the service file to understand where to add the new methods.Assistant
Now let me look at the Listener creation in ElbV2Service to ensure listener attributes are initialized properly.
<tool_call> <function=bash_terminal> <parameter=command> grep -n "createListener" src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2Service.java | head -5 </tool_call>
Assistant
The command was not executed properly. Let me run the grep command again.
Assistant
Let me look at the
createListenermethod to see how it initializes listener attributes.Assistant
Now I understand the structure. I see that the
createListenermethod does not initialize the attributes map explicitly. However, since it's already initialized in the Listener model constructor, it should be fine.Now I need to:
- Add the methods to
ElbV2Servicefor listener attributes and capacity reservation - Add the handlers in
ElbV2QueryHandler
Let me first add the methods to
ElbV2Service. I'll add them after the listener certificates section. Let me find a good place to add them.<tool_call> <function=bash_terminal> <parameter=command> grep -n "describeListenerCertificates|addListenerCertificates|removeListenerCertificates" src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2Service.java </tool_call>
- Add the methods to
Assistant
Let me run the command properly to find the listener certificates methods.
Assistant
Now let me look at the line range around the listener certificates methods to find a good place to add the new methods.
<tool_call> <function=bash_terminal> <parameter=command> sed -n '620,660p' src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2Service.java </tool_call>
Assistant
Let me try running the sed command again to view the section I need to add the new methods after.
Assistant
Now I'll add the new methods to
ElbV2Service. I'll insert them before the "Helpers" section (around line 640).Assistant
Let me use the edit command to add the new methods to ElbV2Service. I'll insert them before the "Helpers" section.
Assistant
Now I'll use sed to insert these methods before the "Helpers" section.
Assistant
Let me verify the methods were added correctly.
Assistant
Let me fix the comment ordering to have the new sections in a better order:
Assistant
Now let me view the file to verify the correct state:
Assistant
Now I need to add the handler methods in
ElbV2QueryHandler. Let me first look at where the switch statement is and add the cases for the three new actions.Assistant
Now I need to add the three new actions to the switch statement in
ElbV2QueryHandler. I'll add them after the "Listener certs" section and before thedefaultcase.Assistant
Let me insert the three new cases for the listener attributes and capacity reservation:
Assistant
Let me verify the change was applied correctly:
Assistant
Now I need to add the three handler methods in
ElbV2QueryHandler. Let me find a good place to add them. I'll add them near the other listener attribute handlers.Assistant
Let me look at the handleDescribeLoadBalancerAttributes method to understand its implementation pattern:
Assistant
Let me find a good place to add the new handler methods. I'll add them after the other attribute handlers. Let me find where the handleDescribeLoadBalancerAttributes method ends:
Assistant
Good, I can see the handleDescribeLoadBalancerAttributes method ends at line 213. Now I'll add the new handler methods after line 213. Let me create the new handler methods:
Assistant
Now let me insert these handler methods after line 213:
Assistant
Let me verify the handlers were added correctly:
Assistant
I see there's an extra closing brace
}at line 272 after the handleDescribeCapacityReservation method. I need to remove this extra brace. Let me fix that.<tool_call> <function=bash_terminal> <parameter=command> sed -n '268,275p' src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2QueryHandler.java </tool_call>
Assistant
The command was not executed. Let me try the sed command again.
Assistant
Let me check the area around line 272 to see the extra brace:
Assistant
I see the issue - there's an extra closing brace at line 278 (after the handleDescribeCapacityReservation method). I need to remove that extra brace.
Let me delete line 278.
Assistant
Now let me verify the fix and check the code structure is correct:
Assistant
Now let me try to compile the code to check for any errors:
Assistant
Let me try running maven directly:
<tool_call> <function=bash_terminal> <parameter=command> mvn compile -q 2>&1 | head -50 </tool_call>
Assistant
Let me try running the maven compile command properly.
Assistant
Let me look at line 217 in the file to see what the issue is:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '210,225p' src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2QueryHandler.java </tool_call>
Assistant
The command was not executed. Let me try again.
Assistant
I see the issue - there's a missing closing brace
}for thehandleDescribeLoadBalancerAttributesmethod before the new handler methods are defined. The method body at line 213 hasreturn Response.ok(xml.build())...but is missing the closing brace}.Let me check the structure more carefully:
Assistant
I see the issue - the
handleDescribeLoadBalancerAttributesmethod is missing its closing brace. Let me fix this by adding the missing closing brace after line 213:Assistant
Let me verify the fix and try compiling again.
Assistant
Let me try compiling again:
Assistant
The compilation succeeded. Let me now run the existing tests to make sure the changes don't break anything:
Assistant
The tests passed! Let me also check if there are any additional tests to run, especially for ELBv2:
<tool_call> <function=bash_terminal> <parameter=command> mvn test -Dtest=ElbV2LambdaTargetIntegrationTest -q 2>&1 | head -100 </tool_call>
Assistant
Let me run the second test file.
Assistant
Assistant
The script was created successfully. Now let me run the test script to verify the fix.
Assistant
The file was not created properly. Let me create the test script again.
<tool_call> <function=bash_terminal> <parameter=command> cat > /tmp/test_fix.sh << 'TESTEOF' #!/bin/bash set -e echo "Starting Floci..." cd /floci mvn quarkus:dev -q & FLOCI_PID=$! sleep 15
Assistant
The test script was created. Now let me run it to verify the fix works.
Assistant
It seems the script is not being created. Let me check if it exists and try a different approach.
<tool_call> <function=bash_terminal> <parameter=command> ls -la /tmp/test_fix.sh 2>&1 </tool_call>
Assistant
Let me try checking if the file exists and create it properly.
Assistant
The file wasn't created. This is strange because the heredoc command seemed to work. Let me try a different approach - create the test script using echo statements.
<tool_call> <function=bash_terminal> <parameter=command> echo '#!/bin/bash' > /tmp/test_fix.sh && echo 'echo "Test script created"' >> /tmp/test_fix.sh && ls -la /tmp/test_fix.sh </tool_call>
Assistant
The command didn't run successfully. Let me try a simpler approach to check if the shell commands are working.
Assistant
That works. Let me try creating the file with the heredoc command again:
Assistant
Now let me check if the file was created:
Assistant
The file was created. The issue before was that the heredoc with
TESTEOFwas getting confused with shell variables or something. Let me now run a simpler manual test directly using curl:Assistant
Now let me wait for Floci to be ready and then test the endpoints:
Assistant
Let me verify that the Listener model already has an attributes map that is initialized. Let me also look at how the listener XML response is generated to make sure it includes attributes if they're set.
Assistant
Let me look at how listeners are serialized in the XML output to see if the Listener model's attributes field is included. I need to find the
listenerXmlmethod or similar:Assistant
Let me look at the listenerXml method to understand how it serializes listener data:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '877,920p' src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2QueryHandler.java </tool_call>
Assistant
Let me try viewing the listenerXml method in the query handler.
Assistant
Good, I see that the
listenerXmlmethod doesn't include the attributes. This is consistent with AWS behavior where attributes are typically not returned in the listener's main XML response - they have to be explicitly requested via DescribeListenerAttributes.Now let me verify my implementation is correct by checking the git diff to see all the changes I've made:
<tool_call> <function=bash_terminal> <parameter=command> git diff --stat </tool_call>
Assistant
The command didn't run. Let me try again with a simpler command.
Assistant
Let me see the actual diff to confirm all the changes are correct:
<tool_call> <function=bash_terminal> <parameter=command> git diff src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2Service.java | head -80 </tool_call>
Assistant
The command didn't run. Let me try again with a simpler approach.
Assistant
Now let me see the ElbV2QueryHandler changes:
<tool_call> <function=bash_terminal> <parameter=command> git diff src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2QueryHandler.java </tool_call>
Assistant
The command didn't run properly. Let me try again.
Assistant
Now let me see the CapacityReservation model class:
<tool_call> <function=bash_terminal> <parameter=command> cat src/main/java/io/github/hectorvent/floci/services/elbv2/model/CapacityReservation.java </tool_call>
Assistant
Let me try the cat command again to view the CapacityReservation file.
Assistant
All the changes look good. Let me run the tests again to confirm everything is working:
<tool_call> <function=bash_terminal> <parameter=command> mvn test -Dtest=ElbV2IntegrationTest 2>&1 | tail -30 </tool_call>
Assistant
Let me try running the test again with a simpler command.
Assistant
All 27 tests passed. Now let me verify the fix by checking if the code handles edge cases correctly. Let me also look at how the listener attributes should be handled - the issue mentioned that listeners should return an empty attribute list by default (similar to how load balancers and target groups work).
Looking at my implementation, I've added:
CapacityReservationmodel class with null-safe fieldsdescribeListenerAttributes()andmodifyListenerAttributes()methods inElbV2ServicedescribeCapacityReservation()method inElbV2Service- Three handler methods in
ElbV2QueryHandlerfor the three new API actions - Switch cases to route the actions to the handlers
The implementation follows the same pattern as the existing
describeLoadBalancerAttributes/modifyLoadBalancerAttributesanddescribeTargetGroupAttributes/modifyTargetGroupAttributesmethods.Assistant
Let me check the Listener model to ensure the attributes map is properly initialized.
Assistant
Let me check the fields initialization in the Listener class:
<tool_call> <function=bash_terminal> <parameter=command> grep "Map<String, String> attributes" src/main/java/io/github/hectorvent/floci/services/elbv2/model/Listener.java </tool_call>
Assistant
Let me verify the Listener attributes field is initialized.
Assistant
The Listener model already has an initialized
attributesmap as aLinkedHashMap<>(), which meansdescribeListenerAttributes()will return an empty map by default - exactly as expected.Now let me also verify that my implementation handles edge cases properly. Let me check if there's any issue with how the empty attributes list is handled in the XML response when there are no attributes:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '220,235p' src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2QueryHandler.java </tool_call>
Assistant
Let me check the XML response for DescribeListenerAttributes to ensure it correctly handles empty attributes.
Assistant
The XML response will have an empty
Attributeselement when there are no attributes, which is the expected behavior (similar to what AWS returns for listeners with no attributes set).Now let me verify the CapacityReservation response handles the null fields correctly:
Assistant
Let me run all ELBv2 tests to ensure everything is working correctly:
Assistant
All 36 ELBv2 tests passed! Let me also verify that the code compiles correctly and check if there are any additional test files that might be affected.
Now let me create a summary of the changes made:
Summary of Changes
I've implemented support for the three missing ELBv2 API actions mentioned in the issue:
1. Created
CapacityReservationmodel class- File:
src/main/java/io/github/hectorvent/floci/services/elbv2/model/CapacityReservation.java - Contains fields: , ,
- File:
Assistant
Let me run all the tests to ensure nothing is broken:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.