示例#1
0
        private static async void Run()
        {

            var client = new KongClient("http://10.10.0.35:8001").RegisterPluginsFrom(typeof(PluginRequestFactory).Assembly);

            var apis = client.Apis();

        }
示例#2
0
        public void SettingConsumer(KongClient client, AppConfig appConfig)
        {
            if (!appConfig.Gateway.EnableAuth)
            {
                return;
            }

            Task.Run(async() =>
            {
                Consumer consumer = new Consumer()
                {
                    Id        = Guid.NewGuid(),
                    UserName  = "******",
                    Custom_id = "ketchup",
                    Tags      = new string[] { "ketchup.zero" }
                };
                await client.Consumer.UpdateOrCreate(consumer);
            }).Wait();
        }
 /// <summary>
 /// Adds Kong Client to the Kong Gateway UpStreams And HealthChecks Registration
 /// </summary>
 /// <param name="app"></param>
 /// <param name="client"></param>
 /// <param name="upStream"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static IApplicationBuilder UseKong(this IApplicationBuilder app, KongClient client, UpStream upStream, TargetInfo target)
 {
     return(app.UseKong(client, upStream, target, null));
 }
        /// <summary>
        ///  Adds Kong Client to the Kong Gateway UpStreams And HealthChecks Registration
        /// </summary>
        /// <param name="app"></param>
        /// <param name="configuration"></param>
        /// <param name="client"></param>
        /// <param name="targetHost">upstrea.target.target{target host:port}</param>
        /// <returns></returns>
        public static IApplicationBuilder UseKong(this IApplicationBuilder app, IConfiguration configuration, KongClient client)
        {
            var upStream = configuration.GetSection("kong:upstream").Get <UpStream>();
            var target   = configuration.GetSection("kong:target").Get <TargetInfo>();

            return(app.UseKong(client, upStream, target, null));
        }
示例#5
0
        public BaseTest()
        {
            var options = new KongClientOptions(httpClient: new System.Net.Http.HttpClient(), host: "http://172.16.1.243:8001");

            client = new KongClient(options);
        }