コード例 #1
0
        public CreateRateLimitResponse CreateRateLimit(CloudflareRateLimitRule rateLimitRule)
        {
            CreateRateLimitResponse createRateLimitResponse = new CreateRateLimitResponse();
            string url = "{1}/zones/{0}/rate_limits";

            url = string.Format(url, _zoneId, _apiUrlPrefix);
            string json    = JsonConvert.SerializeObject(rateLimitRule);
            string content = HttpPost(url, json, 90);

            createRateLimitResponse = JsonConvert.DeserializeObject <CreateRateLimitResponse>(content);
            return(createRateLimitResponse);
        }
コード例 #2
0
        public CreateRateLimitResponse CreateRateLimit(string zoneId, string authEmail, string authKey, RateLimitRule rateLimitRule)
        {
            CreateRateLimitResponse createRateLimitResponse = new CreateRateLimitResponse();
            string url = "https://api.cloudflare.com/client/v4/zones/{0}/rate_limits";

            url = string.Format(url, zoneId);
            string json = JsonConvert.SerializeObject(rateLimitRule);
            //解密
            var    authKeyDecrypt = Utils.AesDecrypt(authKey);
            string content        = HttpPost(authEmail, authKeyDecrypt, url, json, 90);

            createRateLimitResponse = JsonConvert.DeserializeObject <CreateRateLimitResponse>(content);
            return(createRateLimitResponse);
        }