public static void SetClsClient(string key, TencentCloudClsNativeConfig nativeConfig)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (nativeConfig == null)
            {
                throw new ArgumentNullException(nameof(nativeConfig));
            }

            nativeConfig.Check();

            if (key == Constants.GeneralClientKey)
            {
                throw new ArgumentException($"Key cannot be same as '{Constants.GeneralClientKey}'.");
            }

            var authorization = new Authorization {
                SecretId  = nativeConfig.SecretId,
                SecretKey = nativeConfig.SecretKey,
            };

            var client = new TencentCloudClsClient(authorization, new TimeSpan(0, 0, nativeConfig.RequestTimeout));

            SetClsClient(key, nativeConfig.RequestUri, client, nativeConfig.TopicId, nativeConfig.IsGeneralClient);
        }
        public static void Check(this TencentCloudClsNativeConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (string.IsNullOrWhiteSpace(config.RequestUri))
            {
                throw new ArgumentNullException(nameof(config.RequestUri));
            }

            if (string.IsNullOrWhiteSpace(config.SecretId))
            {
                throw new ArgumentNullException(nameof(config.SecretId));
            }

            if (string.IsNullOrWhiteSpace(config.SecretKey))
            {
                throw new ArgumentNullException(nameof(config.SecretKey));
            }

            if (string.IsNullOrWhiteSpace(config.TopicId))
            {
                throw new ArgumentNullException(nameof(config.TopicId));
            }
        }
        /// <summary>
        /// Use Tencent Cloud CLS native config
        /// </summary>
        /// <param name="key"></param>
        /// <param name="nativeAct"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public TencentCloudClsSinkOptions UseNativeConfig(string key, Action <TencentCloudClsNativeConfig> nativeAct)
        {
            if (nativeAct == null)
            {
                throw new ArgumentNullException(nameof(nativeAct));
            }

            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentNullException(nameof(key));
            }

            var cfg = new TencentCloudClsNativeConfig();

            nativeAct(cfg);

            cfg.Check();

            if (TencentCloudClsNativeConfigs.ContainsKey(key))
            {
                TencentCloudClsNativeConfigs[key] = cfg;
            }
            else
            {
                TencentCloudClsNativeConfigs.Add(key, cfg);
            }

            return(this);
        }
        public static bool IsValid(this TencentCloudClsNativeConfig config)
        {
            if (config == null)
            {
                return(false);
            }

            try {
                config.Check();
            }
            catch {
                return(false);
            }

            return(true);
        }