DecodeLogGroup splits a CloudWatch Log Group into: - Ingestion (Data Payload / PutLogEvents) - Storage (Storage Snapshot) — skipped for DELIVERY class (fixed 2-day retention)
(record resources.ResourceRecord, region, inputsJSON string)
| 12 | // - Ingestion (Data Payload / PutLogEvents) |
| 13 | // - Storage (Storage Snapshot) — skipped for DELIVERY class (fixed 2-day retention) |
| 14 | func DecodeLogGroup(record resources.ResourceRecord, region, inputsJSON string) []resources.DecodedResource { |
| 15 | logGroupClass := ExtractInput(record.Inputs, "logGroupClass") |
| 16 | |
| 17 | group := "Ingested Logs" |
| 18 | if strings.EqualFold(logGroupClass, "INFREQUENT_ACCESS") { |
| 19 | group = "IA Custom ingested Logs" |
| 20 | } |
| 21 | |
| 22 | props := map[string]string{"type": record.Type} |
| 23 | if logGroupClass != "" { |
| 24 | props["logGroupClass"] = logGroupClass |
| 25 | } |
| 26 | if v := ExtractInput(record.Inputs, "name"); v != "" { |
| 27 | props["name"] = v |
| 28 | } |
| 29 | if v := ExtractInput(record.Inputs, "retentionInDays"); v != "" { |
| 30 | props["retentionInDays"] = v |
| 31 | } |
| 32 | |
| 33 | result := []resources.DecodedResource{ |
| 34 | { |
| 35 | Provider: "aws", |
| 36 | Region: region, |
| 37 | Service: "CloudWatch Logs", |
| 38 | Name: record.Name, |
| 39 | SubLabel: "Ingestion", |
| 40 | RawType: record.Type, |
| 41 | Attrs: map[string]string{"productFamily": "Data Payload", "operation": "PutLogEvents", "group": group, "servicecode": "AmazonCloudWatch"}, |
| 42 | Props: props, |
| 43 | InputsJSON: inputsJSON, |
| 44 | }, |
| 45 | } |
| 46 | |
| 47 | // DELIVERY class has fixed 2-day retention with no separate storage charge. |
| 48 | if !strings.EqualFold(logGroupClass, "DELIVERY") { |
| 49 | result = append(result, resources.DecodedResource{ |
| 50 | Provider: "aws", |
| 51 | Region: region, |
| 52 | Service: "CloudWatch Logs", |
| 53 | Name: record.Name, |
| 54 | SubLabel: "Storage", |
| 55 | RawType: record.Type, |
| 56 | Attrs: map[string]string{"productFamily": "Storage Snapshot", "servicecode": "AmazonCloudWatch"}, |
| 57 | Props: props, |
| 58 | InputsJSON: inputsJSON, |
| 59 | }) |
| 60 | } |
| 61 | |
| 62 | return result |
| 63 | } |
| 64 | |
| 65 | // DecodeContributorInsightRule decodes a CloudWatch Contributor Insight Rule. |
| 66 | // Produces two billable resources: the rule itself and matched events. |
nothing calls this directly
no test coverage detected