feat(aws-compat): queue attributes for Terraform (FifoQueue, ContentBasedDeduplication, Policy, real timestamps)

- GetQueueAttributes now returns FifoQueue, ContentBasedDeduplication, Policy and
  real Created/LastModifiedTimestamp (previously missing/stubbed '0000000000')
- Queue: add CreatedAt, LastModifiedAt, Policy, ContentBasedDeduplication
- parse FifoQueue/ContentBasedDeduplication in both protocols (StringToBool)
- Policy/RedriveAllowPolicy: normalize JSON-string form to object (JSON protocol
  sent them as string -> SetQueueAttributes failed with InvalidParameterValue)
- persistence: keep new fields in meta DTO + backfill empty timestamps on load
- FIFO dedup is inherent: IsDuplicate/InitDuplicatation gate on IsFIFO only
  (env flag EnableDuplicates=false disabled dedup for all FIFO queues)
This commit is contained in:
Repinoid
2026-10-10 17:29:58 +03:00
parent 22fa2b162a
commit 9f1242aca3
7 changed files with 171 additions and 16 deletions
+28
View File
@@ -34,3 +34,31 @@ func (s *StringToInt) UnmarshalJSON(data []byte) error {
func (s *StringToInt) Int() int {
return int(*s)
}
// StringToBool — аналог StringToInt для булевых атрибутов: принимает и JSON-bool
// (true/false), и строку ("true"/"false"). Query-протокол шлёт строки,
// JSON-протокол — булевы значения; без этого FifoQueue/ContentBasedDeduplication
// из JSON-запроса молча терялись бы.
type StringToBool bool
func (s *StringToBool) UnmarshalJSON(data []byte) error {
var b bool
if err := json.Unmarshal(data, &b); err == nil {
*s = StringToBool(b)
return nil
}
var str string
if err := json.Unmarshal(data, &str); err != nil {
return err
}
tmp, err := strconv.ParseBool(str)
if err != nil {
return err
}
*s = StringToBool(tmp)
return nil
}
func (s *StringToBool) Bool() bool {
return bool(*s)
}