DecodeSNSTopic splits an SNS Topic into multiple pricing queries: - API Requests (always) — Standard uses SNS-Requests-Tier1, FIFO uses SNS-FIFO-Requests - FIFO Storage (when fifoTopic=true) — SNS-FIFO-Storage - FIFO Archive Processing (when fifoTopic=true and archivePolicy is set) — SNS-FIFO-Archi
(record resources.ResourceRecord, region, inputsJSON string)
| 58 | // Message Delivery pricing is handled separately by DecodeSNSTopicSubscription, |
| 59 | // since the endpoint type is determined by the subscription's protocol. |
| 60 | func DecodeSNSTopic(record resources.ResourceRecord, region, inputsJSON string) []resources.DecodedResource { |
| 61 | isFIFO := strings.EqualFold(ExtractInput(record.Inputs, "fifoTopic"), "true") |
| 62 | hasFilterPolicy := ExtractInput(record.Inputs, "filterPolicy") != "" |
| 63 | hasArchivePolicy := ExtractInput(record.Inputs, "archivePolicy") != "" |
| 64 | |
| 65 | props := snsBaseProps(record) |
| 66 | |
| 67 | var results []resources.DecodedResource |
| 68 | |
| 69 | // 1. API Requests — every topic incurs publish request charges. |
| 70 | requestGroup := "SNS-Requests-Tier1" |
| 71 | if isFIFO { |
| 72 | requestGroup = "SNS-FIFO-Requests" |
| 73 | } |
| 74 | results = append(results, snsEntry(record, region, inputsJSON, "Requests", |
| 75 | map[string]string{"group": requestGroup, "productFamily": "API Request"}, |
| 76 | props)) |
| 77 | |
| 78 | // 2. FIFO-specific charges. |
| 79 | if isFIFO { |
| 80 | // FIFO Storage: messages stored in the FIFO topic queue. |
| 81 | results = append(results, snsEntry(record, region, inputsJSON, "FIFO Storage", |
| 82 | map[string]string{"group": "SNS-FIFO-Storage"}, |
| 83 | props)) |
| 84 | |
| 85 | // FIFO Archive Processing: charged when archivePolicy is configured. |
| 86 | if hasArchivePolicy { |
| 87 | results = append(results, snsEntry(record, region, inputsJSON, "FIFO Archive Processing", |
| 88 | map[string]string{"group": "SNS-FIFO-ArchiveProcessing"}, |
| 89 | props)) |
| 90 | } |
| 91 | |
| 92 | // FIFO Payload Message Filtering (when filterPolicy is set). |
| 93 | if hasFilterPolicy { |
| 94 | results = append(results, snsEntry(record, region, inputsJSON, "FIFO Filter Matched", |
| 95 | map[string]string{"group": "SNS-FIFO-Payload-MessageFiltering-Filter-Matched"}, |
| 96 | props)) |
| 97 | results = append(results, snsEntry(record, region, inputsJSON, "FIFO Filter Filtered-Out", |
| 98 | map[string]string{"group": "SNS-FIFO-Payload-MessageFiltering-Filtered-Out"}, |
| 99 | props)) |
| 100 | } |
| 101 | } else { |
| 102 | // Standard Payload Message Filtering (when filterPolicy is set). |
| 103 | if hasFilterPolicy { |
| 104 | results = append(results, snsEntry(record, region, inputsJSON, "Filter Matched", |
| 105 | map[string]string{"group": "SNS-Standard-Payload-MessageFiltering-Filter-Matched"}, |
| 106 | props)) |
| 107 | results = append(results, snsEntry(record, region, inputsJSON, "Filter Filtered-Out", |
| 108 | map[string]string{"group": "SNS-Standard-Payload-MessageFiltering-Filtered-Out"}, |
| 109 | props)) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | return results |
| 114 | } |
| 115 | |
| 116 | // protocolToEndpointType maps a Pulumi SNS subscription protocol to the AWS |
| 117 | // pricing endpointType attribute used in the "Message Delivery" product family. |
nothing calls this directly
no test coverage detected