in src/main/scala/org/apache/pekko/persistence/dynamodb/query/scaladsl/DynamoDBCurrentPersistenceIdsQuery.scala [73:92]
def createPersistenceIdsIndexRequest(
indexName: String,
tableName: String,
alphabetically: Boolean = false): UpdateTableRequest = {
val createIndex = new CreateGlobalSecondaryIndexAction()
.withIndexName(indexName)
.withProjection(new Projection().withProjectionType(ProjectionType.KEYS_ONLY))
.withProvisionedThroughput(new ProvisionedThroughput().withReadCapacityUnits(10).withWriteCapacityUnits(10))
if (alphabetically) {
createIndex.withKeySchema(
new KeySchemaElement().withAttributeName("num").withKeyType(KeyType.HASH),
new KeySchemaElement().withAttributeName("par").withKeyType(KeyType.RANGE))
} else {
createIndex.withKeySchema(new KeySchemaElement().withAttributeName("num").withKeyType(KeyType.HASH))
}
new UpdateTableRequest()
.withTableName(tableName)
.withGlobalSecondaryIndexUpdates(new GlobalSecondaryIndexUpdate().withCreate(createIndex))
.withAttributeDefinitions(new AttributeDefinition().withAttributeName("num").withAttributeType("N"))
}