aws-sdk-go-v2
aws-sdk-go-v2 copied to clipboard
SSM GetConnectionStatus Does Not Match ConnectionStatus Types
Documentation
- [X] I've gone though the API reference
- [X] I've checked AWS Forums and StackOverflow for answers
- [X] I've searched for previous similar issues and didn't find any solution
Describe the bug
The status returned from the GetConnectionStatus call returns a status with the string "notconnected" or "connected". The types ConnectionStatusConnected has a value of "Connected". When comparing the status the following code always returns false.
resp, err := svc.GetConnectionStatus(context.Background(), &ssm.GetConnectionStatusInput{
Target: aws.String("TEST_ID"),
})
if resp.Status == ConnectionStatusConnected {
...
}
Expected behavior
Either the response from the api call should have a status of "Connected" or the ConnectionStatusConnected should be set to "connected"
Current behavior
The api call returns a status that is all lowercase characters but the constant type has capital letters.
Steps to Reproduce
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ssm"
ssmtype "github.com/aws/aws-sdk-go-v2/service/ssm/types"
)
func main() {
cfg, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
panic(err)
}
svc := ssm.NewFromConfig(cfg)
resp, err := svc.GetConnectionStatus(context.Background(), &ssm.GetConnectionStatusInput{
Target: aws.String("TEST_INSTANCE_ID"),
})
if err != nil {
panic(err)
}
fmt.Println(resp.Status)
fmt.Println(ssmtype.ConnectionStatusConnected)
fmt.Println(resp.Status == ssmtype.ConnectionStatusConnected)
}
- Replace "TEST_INSTANCE_ID" with the id of an ec2 instance that has the SSM agent connected.
- Run the code
Possible Solution
No response
AWS Go SDK version used
aws-sdk-go-v2 v1.14.0 aws-sdk-go-v2/service/ssm v1.21.0
Compiler and Version used
go version go1.17.6 linux/amd64
Operating System and version
Ubuntu 18.04
Hi @toneill818 is this still persisting with the latest version of SDK? I am having trouble to reproduce the same behavior?
This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
@toneill818 this was fixed in a release last week: https://github.com/aws/aws-sdk-go-v2/releases/tag/release-2023-09-25
⚠️COMMENT VISIBILITY WARNING⚠️
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.