Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

DescribeLoadBalancers API call doesn't return IpAddressType value for Gateway Load Balancer #341

Closed
ParthaI opened this issue Aug 30, 2022 · 3 comments
Assignees
Labels
bug Something isn't working elbv2 service-api This issue pertains to the AWS API

Comments

@ParthaI
Copy link

ParthaI commented Aug 30, 2022

Describe the bug

The API DescribeLoadBalancers doesn't return IpAddressType value for Gateway Load Balancer but however we are getting the IpAddressType value for Application Load Balancer.

Expected Behavior

We should get the IpAddressType value for Gateway Load Balancer.

Current Behavior

We are getting an empty string for IpAddressType attribute for Gateway Load Balancer though the data is available in AWS console.

Reproduction Steps

Make the DescribeLoadBalancers API call and please verify the IpAddressType value in the result.

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.16.11

Compiler and Version used

go version go1.19 darwin/arm64

Operating System and version

Mac

@ParthaI ParthaI added bug Something isn't working needs-triage labels Aug 30, 2022
@ParthaI ParthaI changed the title (short issue description) DescribeLoadBalancers API call doesn't return IpAddressType value for Gateway Load Balancer Aug 30, 2022
@RanVaknin RanVaknin self-assigned this Aug 31, 2022
@RanVaknin RanVaknin added response-requested This issue requires a response to continue investigating and removed needs-triage response-requested This issue requires a response to continue labels Aug 31, 2022
@RanVaknin
Copy link

Hi @ParthaI ,

The reason you are seeing an empty string for IpAddressType is because the GO default value for an unset enum type is an empty string. The reason the enum is unset is because the ELB is not returning that field in the response.

I was able to verify it with the following GO code:

func main() {
	cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("us-east-1"), config.WithClientLogMode(aws.LogRequestWithBody|aws.LogResponseWithBody))
	if err != nil {
		log.Fatalf("unable to load SDK config, %v", err)
	}

	svc := elasticloadbalancingv2.NewFromConfig(cfg)

	result, err := svc.DescribeLoadBalancers(context.Background(), &elasticloadbalancingv2.DescribeLoadBalancersInput{})
	if err != nil {
		log.Fatalf("failed to retrieve lbs: , %v", err)
	}

	for _, v := range result.LoadBalancers {
		fmt.Printf("type is: %v", v.IpAddressType)
	}
}

Response:

<DescribeLoadBalancersResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
  <DescribeLoadBalancersResult>
    <LoadBalancers>
      <member>
        <LoadBalancerArn>REDACTED</LoadBalancerArn>
        <AvailabilityZones>
          <member>
            <SubnetId>REDACTED</SubnetId>
            <ZoneName>us-east-1a</ZoneName>
          </member>
        </AvailabilityZones>
        <Type>gateway</Type>
        <LoadBalancerName>testlb</LoadBalancerName>
        <VpcId>REDACTED</VpcId>
        <CreatedTime>2022-08-31T16:32:31.524Z</CreatedTime>
        <State>
          <Code>active</Code>
        </State>
      </member>
    </LoadBalancers>
  </DescribeLoadBalancersResult>
  <ResponseMetadata>
    <RequestId>REDACTED</RequestId>
  </ResponseMetadata>
</DescribeLoadBalancersResponse>

And with the CLI:

aws elbv2 describe-load-balancers --region us-east-1

Response:

{
    "LoadBalancers": [
        {
            "LoadBalancerArn": "REDACTED",
            "CreatedTime": "2022-08-31T16:32:31.524000+00:00",
            "LoadBalancerName": "testlb",
            "VpcId": "REDACTED",
            "State": {
                "Code": "active"
            },
            "Type": "gateway",
            "AvailabilityZones": [
                {
                    "ZoneName": "us-east-1a",
                    "SubnetId": "REDACTED"
                }
            ]
        }
    ]
}

I have created an internal ticket with the ELB service team and hopefully we can get that sorted out for you. Please keep an eye on this ticket for updates.

Thanks,
Ran~

P70930374

@RanVaknin RanVaknin transferred this issue from aws/aws-sdk-go-v2 Aug 31, 2022
@RanVaknin RanVaknin added service-api This issue pertains to the AWS API elbv2 labels Aug 31, 2022
@RanVaknin
Copy link

This is now added:

$ aws elbv2 describe-load-balancers --region us-east-1

{
    "LoadBalancers": [
        {
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-east-1:REDACTED:loadbalancer/gwy/testlb/REDACTED",
            "CreatedTime": "2022-08-31T16:32:31.524000+00:00",
            "LoadBalancerName": "testlb",
            "VpcId": "vpc-REDADTED",
            "State": {
                "Code": "active"
            },
            "Type": "gateway",
            "AvailabilityZones": [
                {
                    "ZoneName": "us-east-1a",
                    "SubnetId": "subnet-REDACTED"
                }
            ],
            "IpAddressType": "ipv4"
        }
    ]
}

Thank you for your patience.
All the best,
Ran~

@github-actions
Copy link

This issue is now closed.

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working elbv2 service-api This issue pertains to the AWS API
Projects
None yet
Development

No branches or pull requests

2 participants