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
If you try to use aws.Credentials
type with an incoming assume role request, it doesn't map the values correctly because it uses "Expires" vs "Expiration"
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
If the other match, it seems like the expiration date field should also. While this may not be the standard use case, I see a few points with the AWS GoV2 that could benefit from this as well. Maintaining names would also help people when they go though AWS docs and code examples.
Current Behavior
Tldr: It seems like is Expiration either omitted or misspelled in Credentials type.
Reproduction Steps
To reproduce:
type AwsCredentials struct {
Credentials aws.Credentials
}
Have the above type and then the following code (omitting if err != nil {
statements for readability) :
req, err := http.NewRequest("GET", "https://"+our creds endpoint+"/role-aliases/"+role name here+"/credentials", nil) // make req
req.Header.Add("x-amzn-iot-thingname", deviceName) //add header
res, err := httpClient.Do(req) //do request
defer res.Body.Close()
awsCreds := &types.AwsCredentials{} // using Credentials Type here to init
json.NewDecoder(res.Body).Decode(awsCreds) // decoding with that type
Now if you print out awsCreds, it returns 0001-01-01T00:00:00Z
for Expires
- I am assuming the default go time object.
All the other fields in Credentials match the response names ->
AccessKeyID = AccessKeyId (case is technically slightly off here, but the values still map correctly)
SessionToken = SessionToken
SecretAccessKey = SecretAccessKey
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
latest
Compiler and Version used
1.19
Operating System and version
ubuntu 22.04