コード例 #1
0
        public static async Task Run([TimerTrigger("* * * * * *")] TimerInfo myTimer, ILogger log)
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("local.settings.json", optional: true)
                         .AddEnvironmentVariables()
                         .Build();

            var cosmosUrl     = config["CosmosUrl"];
            var cosmosAuthKey = config["CosmosAuthKey"];

            var customClient = CustomDocumentClient.Of(cosmosUrl, cosmosAuthKey);

            await customClient.ScaleDownAll();
        }
コード例 #2
0
        public CustomDocumentClientTests()
        {
            _documentClient       = new DocumentClient(new Uri(CosmosUrl), CosmosAuthKey);
            _customDocumentClient = CustomDocumentClient.Of(CosmosUrl, CosmosAuthKey);
            _databaseHelper       = DatabaseHelper.Of(CosmosUrl, CosmosAuthKey);

            var type = typeof(DocumentClientException);
            var documentClientExceptionInstance = type.Assembly.CreateInstance(type.FullName,
                                                                               false, BindingFlags.Instance | BindingFlags.NonPublic, null,
                                                                               new object[] { new Error
                                                                                              {
                                                                                                  Id      = Guid.NewGuid().ToString(),
                                                                                                  Code    = "429",
                                                                                                  Message = "Request rate is large"
                                                                                              }, (HttpResponseHeaders)null, HttpStatusCode.TooManyRequests }, null, null);

            _documentClientException = (DocumentClientException)documentClientExceptionInstance;
        }