Ejemplo n.º 1
0
        private static void PrepareForNativeClientInOptions(JdCloudLogSinkOptions options)
        {
            if (options.HasLegalNativeConfig(false))
            {
                return;
            }

            if (options.HasLegalNativeConfig(true))
            {
                return;
            }

            options.UseNativeConfig(Constants.DefaultClient, c => {
                c.LogStreamName   = options.LogStreamName;
                c.SecretKey       = options.SecretKey;
                c.AccessKey       = options.AccessKey;
                c.RetryTimes      = options.RetryTimes;
                c.RequestTimeout  = options.RequestTimeout;
                c.Security        = options.Security;
                c.IsGeneralClient = true;
            });
        }
Ejemplo n.º 2
0
        private static void RegisterJdCloudLogClients(JdCloudLogSinkOptions options)
        {
            if (!options.HasLegalNativeConfig(false))
            {
                throw new InvalidOperationException("There is no legal JD Cloud Log Service native config.");
            }

            if (options.JdCloudLogNativeConfigs.Any())
            {
                foreach (var kvp in options.JdCloudLogNativeConfigs)
                {
                    JdCloudLogClientManager.SetLogClient(kvp.Key, kvp.Value);
                }
            }
            else
            {
                JdCloudLogClientManager.SetLogClient(Constants.DefaultClient,
                                                     options.LogStreamName, options.AccessKey, options.SecretKey, options.Security, options.RequestTimeout,
                                                     true);
            }
        }