aws-sdk-go-v2 icon indicating copy to clipboard operation
aws-sdk-go-v2 copied to clipboard

SSM GetConnectionStatus Does Not Match ConnectionStatus Types

Open toneill818 opened this issue 3 years ago • 2 comments

Documentation

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)
}
  1. Replace "TEST_INSTANCE_ID" with the id of an ec2 instance that has the SSM agent connected.
  2. 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

toneill818 avatar Mar 07 '22 14:03 toneill818

Hi @toneill818 is this still persisting with the latest version of SDK? I am having trouble to reproduce the same behavior?

vudh1 avatar May 23 '22 21:05 vudh1

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.

github-actions[bot] avatar May 26 '22 00:05 github-actions[bot]

@toneill818 this was fixed in a release last week: https://github.com/aws/aws-sdk-go-v2/releases/tag/release-2023-09-25

lucix-aws avatar Oct 05 '23 15:10 lucix-aws

⚠️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.

github-actions[bot] avatar Oct 05 '23 15:10 github-actions[bot]