/// <summary>
        /// 开启日志库索引。
        /// </summary>
        /// <param name="client">client实例。</param>
        /// <param name="logstoreName">Logstore 的名称,在 Project 下必须唯一。</param>
        /// <param name="line">全文索引,对于日志中value的索引属性,全文索引和字段查询必须至少配置一类。</param>
        /// <param name="project">项目名,此参数将覆盖 client 中默认设置。</param>
        /// <returns>异步响应结果。</returns>
        /// <seealso cref="ILogServiceClient.CreateIndexAsync"/>
        /// <exception cref="ArgumentException"><paramref cref="line"/> 为空</exception>
        public static Task <IResponse> CreateIndexAsync(this ILogServiceClient client,
                                                        String logstoreName, IndexLineInfo line,
                                                        String project = null)
        {
            Ensure.NotNull(line, nameof(line));

            return(client.CreateIndexAsync(new CreateIndexRequest(logstoreName, line)
            {
                ProjectName = project
            }));
        }
        /// <summary>
        /// 开启日志库索引。
        /// </summary>
        /// <param name="client">client实例。</param>
        /// <param name="logstoreName">Logstore 的名称,在 Project 下必须唯一。</param>
        /// <param name="line">全文索引,对于日志中value的索引属性,全文索引和字段查询必须至少配置一类。</param>
        /// <param name="keys">字段查询,对于具体字段的value索引属性,全文索引和字段查询必须至少配置一类。</param>
        /// <param name="project">项目名,此参数将覆盖 client 中默认设置。</param>
        /// <returns>异步响应结果。</returns>
        /// <seealso cref="ILogServiceClient.CreateIndexAsync"/>
        /// <exception cref="ArgumentException"><paramref cref="line"/> 和 <paramref name="keys"/> 同时为空</exception>
        public static Task <IResponse> CreateIndexAsync(this ILogServiceClient client,
                                                        String logstoreName, IndexLineInfo line, IDictionary <String, IndexKeyInfo> keys,
                                                        String project = null)
        {
            if (line == null && keys.IsEmpty())
            {
                throw new ArgumentException("line and keys cannot be both empty.");
            }

            return(client.CreateIndexAsync(new CreateIndexRequest(logstoreName, line, keys)
            {
                ProjectName = project
            }));
        }
        /// <summary>
        /// 开启日志库索引。
        /// </summary>
        /// <param name="client">client实例。</param>
        /// <param name="logstoreName">Logstore 的名称,在 Project 下必须唯一。</param>
        /// <param name="line">全文索引,对于日志中value的索引属性,全文索引和字段查询必须至少配置一类。</param>
        /// <param name="keysBuilder">字段查询构建器。</param>
        /// <param name="project">项目名,此参数将覆盖 client 中默认设置。</param>
        /// <returns>异步响应结果。</returns>
        /// <seealso cref="ILogServiceClient.CreateIndexAsync"/>
        /// <exception cref="ArgumentException"><paramref cref="line"/> 和 <paramref name="keysBuilder"/> 同时为空</exception>
        public static Task <IResponse> CreateIndexAsync(this ILogServiceClient client,
                                                        String logstoreName, IndexLineInfo line, Action <IndexKeysBuilder> keysBuilder,
                                                        String project = null)
        {
            IDictionary <String, IndexKeyInfo> keys;

            if (keysBuilder != null)
            {
                var builder = new IndexKeysBuilder();
                keysBuilder(builder);
                keys = builder.Build();
            }
            else
            {
                keys = null;
            }

            return(client.CreateIndexAsync(logstoreName, line, keys, project));
        }