MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / DecodeGlobalTable

Function DecodeGlobalTable

internal/pulumi/resources/aws/dynamodb.go:250–284  ·  view source on GitHub ↗

DecodeGlobalTable decodes a DynamoDB GlobalTable (TableReplicas resource). Produces one replicated-write query per replica region.

(record resources.ResourceRecord, region, inputsJSON string)

Source from the content-addressed store, hash-verified

248// DecodeGlobalTable decodes a DynamoDB GlobalTable (TableReplicas resource).
249// Produces one replicated-write query per replica region.
250func 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.

Callers

nothing calls this directly

Calls 5

billingModeFunction · 0.85
tableClassFunction · 0.85
extractReplicasFunction · 0.85
copyPropsFunction · 0.85
ddbEntryFunction · 0.85

Tested by

no test coverage detected