private def createPathsTableIfMissing()

in path-manager/app/services/Dynamo.scala [65:92]


  private def createPathsTableIfMissing(client: AmazonDynamoDB) = {
    val dynamo = new DynamoDB(client)

    if(!tableExists(pathsTableName, dynamo)) {
      logger.info("creating paths table")
      val table = dynamo.createTable(
        new CreateTableRequest()
          .withTableName(pathsTableName)
          .withAttributeDefinitions(
            new AttributeDefinition("path", ScalarAttributeType.S),
            new AttributeDefinition("identifier", ScalarAttributeType.N),
            new AttributeDefinition("type", ScalarAttributeType.S)
          )
          .withKeySchema(new KeySchemaElement("path", KeyType.HASH))
          .withGlobalSecondaryIndexes(
            new GlobalSecondaryIndex()
              .withIndexName("id-index")
              .withKeySchema(new KeySchemaElement("identifier", KeyType.HASH), new KeySchemaElement("type", KeyType.RANGE) )
              .withProjection(new Projection().withProjectionType(ProjectionType.ALL))
              .withProvisionedThroughput(new ProvisionedThroughput(5L, 5L))
          )
          .withProvisionedThroughput(new ProvisionedThroughput(5L, 5L)) // ignored locally
      )
      table.waitForActive()
    } else {
      logger.info("paths table already exists")
    }
  }