DecodeGlobalTable decodes a DynamoDB GlobalTable (TableReplicas resource). Produces one replicated-write query per replica region.
(record resources.ResourceRecord, region, inputsJSON string)
| 248 | // DecodeGlobalTable decodes a DynamoDB GlobalTable (TableReplicas resource). |
| 249 | // Produces one replicated-write query per replica region. |
| 250 | func DecodeGlobalTable(record resources.ResourceRecord, region, inputsJSON string) []resources.DecodedResource { |
| 251 | isPAY := billingMode(record) == "PAY_PER_REQUEST" |
| 252 | isIA := tableClass(record) == "STANDARD_IA" |
| 253 | |
| 254 | props := map[string]string{ |
| 255 | "type": record.Type, |
| 256 | "billingMode": billingMode(record), |
| 257 | "tableClass": tableClass(record), |
| 258 | } |
| 259 | |
| 260 | replicaRegions := extractReplicas(record) |
| 261 | if len(replicaRegions) == 0 { |
| 262 | // No replicas declared — nothing to price. |
| 263 | return nil |
| 264 | } |
| 265 | |
| 266 | var results []resources.DecodedResource |
| 267 | for _, replicaRegion := range replicaRegions { |
| 268 | replicaWriteGroup := "DDB-ReplicatedWriteUnits" |
| 269 | if isIA { |
| 270 | replicaWriteGroup = "DDB-ReplicatedWriteUnitsIA" |
| 271 | } |
| 272 | // PAY_PER_REQUEST uses DDB-ReplicatedWriteUnits (on-demand replicated writes). |
| 273 | if isPAY { |
| 274 | replicaWriteGroup = "DDB-ReplicatedWriteUnits" |
| 275 | } |
| 276 | replicaProps := copyProps(props) |
| 277 | replicaProps["replicaRegion"] = replicaRegion |
| 278 | |
| 279 | results = append(results, ddbEntry(record, replicaRegion, inputsJSON, |
| 280 | "Replicated Write ("+replicaRegion+")", "DDB-Operation-ReplicatedWrite", |
| 281 | map[string]string{"group": replicaWriteGroup, "operation": "CommittedThroughput"}, replicaProps)) |
| 282 | } |
| 283 | return results |
| 284 | } |
| 285 | |
| 286 | // DecodeKinesisStreamingDestination decodes a DynamoDB Kinesis Streaming Destination. |
| 287 | // Produces a single Kinesis data capture query. |
nothing calls this directly
no test coverage detected