constructor()

in src/dynamodb.ts [34:57]


  constructor(scope: Construct, id: string, props: WatchDynamoTableProps) {
    super(scope, id);

    const table = props.table;
    this.watchful = props.watchful;
    this.metrics = new DynamoDbMetricFactory();

    const cfnTable = table.node.defaultChild as dynamodb.CfnTable;
    const billingMode = cfnTable.billingMode as dynamodb.BillingMode ?? dynamodb.BillingMode.PROVISIONED;

    switch (billingMode) {
      case dynamodb.BillingMode.PAY_PER_REQUEST:
        this.createWidgetsForPayPerRequestTable(props.title, table);
        break;

      case dynamodb.BillingMode.PROVISIONED:
        this.createWidgetsForProvisionedTable(props.title,
          table,
          props.readCapacityThresholdPercent,
          props.writeCapacityThresholdPercent,
        );
        break;
    }
  }