public Task SetThroughputAsync(int throughput) { if (!ThroughputValidator.IsValidThroughput(throughput)) { throw new ArgumentException("The provided throughput is not valid. Must be between 400 and 1000000 and in increments of 100.", nameof(throughput)); } return(_container.ReplaceThroughputAsync(throughput)); }
/// <summary> /// Sets the throughput (RU/s) for the database. /// </summary> /// <param name="throughput">The new throughput to set. Must be between 400 and 1000000 in increments of 100.</param> /// <returns></returns> public Task SetThroughputAsync(int throughput) { if (!ThroughputValidator.IsValidThroughput(throughput)) { throw new ArgumentException("The provided throughput is not valid. Must be between 400 and 1000000 and in increments of 100.", nameof(throughput)); } return(_cosmosClient.GetDatabase(_database.Model.DatabaseId).ReplaceThroughputAsync(throughput)); }
/// <summary> /// Creates the Cosmos database and defined collections if not exists. /// </summary> /// <returns></returns> public Task CreateIfNotExistsAsync(CreateDbOptions options = null) { if (options != null && !ThroughputValidator.IsValidThroughput(options.Throughput)) { throw new ArgumentException("The provided throughput is not valid. Must be between 400 and 1000000 and in increments of 100."); } return(CreateIfNotExistsInternalAsync(options)); }
public void TestIsValidThoughput(int throughput, bool expected) { var isValid = ThroughputValidator.IsValidThroughput(throughput); Assert.Equal(expected, isValid); }