Description
Acknowledgements
- I have searched (https://github.com/aws/aws-sdk/issues?q=is%3Aissue) for past instances of this issue
- I have verified all of my SDK modules are up-to-date (you can perform a bulk update with
go get -u github.com/aws/aws-sdk-go-v2/...
)
Describe the bug
Issue: When we make call to DescribeVpcEndpoints
it returns this State field with value in all characters lower case (available) contrary to what the client State constant defines first character in upper case(Available).
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
I expect DescribeVpcEndpoints
returns the State
field with enum using the same casing as defined in the State.
For example the string value for State should be like Failed
and not like failed
.
Current Behavior
DescribeVpcEndpoints
returns the State
field string value in all lower case like failed
.
Reproduction Steps
Here is the sample code to reproduce the issue.
Replace with real vpcEndpointId
.
if the result says Expected Success
then there is no issue and if it returns Manipulated Success
then this bug exists.
package main
import (
"context"
"fmt"
"log"
"strings"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
)
func main() {
ctx := context.TODO()
cfg, err := config.LoadDefaultConfig(ctx)
if err != nil {
log.Fatal(err)
}
client := ec2.NewFromConfig(cfg)
input := &ec2.DescribeVpcEndpointsInput{
VpcEndpointIds: []string{"<vpc-endpoint-id>"},
}
vpcEndpointsOutput, err := client.DescribeVpcEndpoints(ctx, input)
if err != nil {
fmt.Println("failed", err)
}
state := vpcEndpointsOutput.VpcEndpoints[0].State
fmt.Println(state)
states := types.StatePending.Values()
for _, s := range states {
if strings.ToLower(string(s)) == strings.ToLower(string(state)) {
fmt.Println("checking the correct value")
fmt.Println(s)
if s == types.StateAvailable {
fmt.Println("Manipulated Success")
}
}
}
if state == types.StateAvailable {
fmt.Println("Expected Success")
}
}
Possible Solution
Not sure if this issue is related to deserialization of issue at the server and client values for State.
Additional Information/Context
NA
AWS Go SDK V2 Module Versions Used
This list is too big. The ticket creation failed so I omitted the information, I can provide the details in the comment later.
Compiler and Version used
go version go1.23.0 darwin/amd64
Operating System and version
macOS Sonoma Version 14.6.1