nsmithuk / local-kms

A mock version of AWS' Key Management Service, for local development and testing.
MIT License
198 stars 34 forks source link

ScheduleKeyDeletion returns `DeletionDate` in Standard Form #4

Open nsmithuk opened 5 years ago

nsmithuk commented 5 years ago

On successfully calling ScheduleKeyDeletion, the timestamp in the DeletionDate field returned from AWS is encoded in Scientific Notation/Standard Form. Local KMS returns the value as a standard integer.

For example: AWS returns: 1.5565824E9 Local KMS returns: 1556582400

AWS' SDKs appear to transparently accept either correctly.

There appears no easy way to force Go to output the value as a number, in Scientific Notation. The community conscientious seems to be that as the interpreter should read both numbers identically, thus Go is working as expected.

andrew-d commented 5 years ago

There's always the option of writing a custom MarshalJSON method on a wrapper type, like so: https://play.golang.org/p/3adteafwrAv

The strconv.FormatFloat formatting is also slightly different from the AWS format though, so it's likely to be annoying 😞