/// <summary> /// Adds Kong Client to the specified Microsoft.Extensions.DependencyInjection.IServiceCollection. /// </summary> /// <param name="service"></param> /// <param name="options"></param> /// <returns></returns> public static IServiceCollection AddKong(this IServiceCollection service, KongClientOptions options) { KongClient client = new KongClient(options); service.AddSingleton <KongClient>(fat => client); return(service); }
public GatewayProvider SettingKongService(AppConfig appConfig) { if (string.IsNullOrEmpty(appConfig.Gateway.KongAddress)) { return(this); } var options = new KongClientOptions(httpClient: new System.Net.Http.HttpClient(), host: $"http://{appConfig.Gateway.KongAddress}"); var client = new KongClient(options); var service = new ServiceInfo { Name = appConfig.Gateway.Name, Id = Guid.NewGuid(), Port = appConfig.Gateway.Port, Protocol = appConfig.Gateway.Protocol, Path = appConfig.Gateway.Path, Tags = new string[] { appConfig.Gateway.Name }, Host = appConfig.Gateway.Address, Connect_timeout = 60000, Read_timeout = 60000, Write_timeout = 60000, }; client.Service?.UpdateOrCreate(service); SettingAuthSerice(appConfig, client); return(this); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddKong(() => { var options = new KongClientOptions(HttpClientFactory.Create(), this.Configuration["kong:host"]); return(options); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
public ServiceApi(KongClientOptions options) : base(options) { }
public PluginApi(KongClientOptions options) : base(options) { }
protected BaseApi(KongClientOptions kongOptions) { this.kongOptions = kongOptions; }
public CertificateApi(KongClientOptions options) : base(options) { }
public ConsumerApi(KongClientOptions options) : base(options) { }
public KongClient(KongClientOptions options) { this.options = options; }
public BaseTest() { var options = new KongClientOptions(httpClient: new System.Net.Http.HttpClient(), host: "http://172.16.1.243:8001"); client = new KongClient(options); }
public NodeApi(KongClientOptions options) : base(options) { }
public TargetApi(KongClientOptions options) : base(options) { }
public RouteApi(KongClientOptions options) : base(options) { }
public UpStreamApi(KongClientOptions options) : base(options) { }
public SNIApi(KongClientOptions options) : base(options) { }
public TagsApi(KongClientOptions options) : base(options) { }