aws / aws-sdk-go-v2

AWS SDK for the Go programming language.
https://aws.github.io/aws-sdk-go-v2/docs/
Apache License 2.0
2.5k stars 602 forks source link

PlatformValuesWindows value is incorrect #2588

Closed yusuke-koyoshi closed 3 months ago

yusuke-koyoshi commented 3 months ago

Acknowledgements

Describe the bug

PlatformValuesWindows value is incorrect.

PlatformValuesWindows is windows, not Windows.

https://github.com/aws/aws-sdk-go-v2/blob/6a694c7d3df3177fe4c4bbfff7e2e7a7733619bb/service/ec2/types/enums.go#L6224-L6238

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-instances.html https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html

platform - The platform. To list only Windows instances, use windows .

Expected Behavior

Values can be compared using types.PlatformValuesWindows

Current Behavior

No match when comparing values using types.PlatformValuesWindows

Reproduction Steps

        describeResult, err := client.DescribeInstances(context.Background(), instanceInput)
    if err != nil {
        return err
    }

    for _, reservation := range describeResult.Reservations {
        for _, instance := range filterInstance(reservation.Instances) {
            if instance.Platform == ec2Types.PlatformValuesWindows {
                fmt.Printf("Windows instance: %s\n", *instance.InstanceId)
            }
        }
    }

Possible Solution

https://github.com/aws/aws-sdk-go-v2/blob/6a694c7d3df3177fe4c4bbfff7e2e7a7733619bb/service/ec2/types/enums.go#L6224-L6238

Change PlatformValuesWindows to windows

const (
    PlatformValuesWindows PlatformValues = "windows"
)

// Values returns all known values for PlatformValues. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (PlatformValues) Values() []PlatformValues {
    return []PlatformValues{
        "windows",
    }
}

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-lambda-go v1.46.0
github.com/aws/aws-sdk-go-v2 v1.26.0
github.com/aws/aws-sdk-go-v2/config v1.27.9
github.com/aws/aws-sdk-go-v2/credentials v1.17.9
github.com/aws/aws-sdk-go-v2/service/batch v1.36.0
github.com/aws/aws-sdk-go-v2/service/ec2 v1.155.0
github.com/aws/aws-sdk-go-v2/service/ecr v1.27.3
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.3
github.com/aws/aws-sdk-go-v2/service/sqs v1.31.3
github.com/aws/aws-sdk-go-v2/service/ssm v1.49.4
github.com/aws/aws-sdk-go-v2/service/sts v1.28.5

Compiler and Version used

go version go1.22.1 darwin/arm64

Operating System and version

macOS 13.6.5

lucix-aws commented 3 months ago

AWS SDKs are generated from API models owned by the service team, this is not something we can change directly in the SDK. If you believe the value of this enum variant is incorrect you will need to engage EC2 support by using the AWS console to open a ticket.

RanVaknin commented 3 months ago

Hi @yusuke-koyoshi I created a ticket with the EC2 service team on your behalf (P124521734) and notified your dedicated support person. They should be able to drive this from there.

All the best, Ran~