Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set the new RU
//5) Get the RU increment from AppSettings and parse to an int
if (int.TryParse(config["CosmosDB_RU"], out int RUIncrement))
{
//5.a) create the new offer with the throughput increment added to the current throughput
int newThroughput = throughputCurrent + RUIncrement;
offer = new OfferV2(offer, newThroughput);
//5.b) persist the changes
await client.ReplaceOfferAsync(offer);
log.LogInformation(string.Format("New provisioned througput: {0} RU", newThroughput.ToString()));
return new OkObjectResult("The collection's throughput was changed...");
}
else
{
//5.c) if the throughputIncrement cannot be parsed return throughput not changed
return new BadRequestObjectResult("PARSE ERROR: The collection's throughput was not changed...");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment