Skip to content

Instantly share code, notes, and snippets.

@sajeetharan
Last active June 18, 2019 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sajeetharan/d38fbb251e9e57177a5e68c5735a0fef to your computer and use it in GitHub Desktop.
Save sajeetharan/d38fbb251e9e57177a5e68c5735a0fef to your computer and use it in GitHub Desktop.
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