diff --git a/TelpoKafkaConsole.WebApi/Controllers/WeatherForecastController.cs b/TelpoKafkaConsole.WebApi/Controllers/WeatherForecastController.cs index 737d74e..5a9a6d4 100644 --- a/TelpoKafkaConsole.WebApi/Controllers/WeatherForecastController.cs +++ b/TelpoKafkaConsole.WebApi/Controllers/WeatherForecastController.cs @@ -1,74 +1,74 @@ -using Confluent.Kafka; -using Confluent.Kafka.Admin; -using Microsoft.AspNetCore.Mvc; -using TelpoKafkaConsole.Service; -using TelpoKafkaConsole.WebApi.Controllers.Api; +//using Confluent.Kafka; +//using Confluent.Kafka.Admin; +//using Microsoft.AspNetCore.Mvc; +//using TelpoKafkaConsole.Service; +//using TelpoKafkaConsole.WebApi.Controllers.Api; -namespace TelpoKafkaConsole.WebApi.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private readonly KafkaAdminService _servicekafkaAdmin; +//namespace TelpoKafkaConsole.WebApi.Controllers +//{ +// [ApiController] +// [Route("[controller]")] +// public class WeatherForecastController : ControllerBase +// { +// private readonly KafkaAdminService _servicekafkaAdmin; - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; +// private static readonly string[] Summaries = new[] +// { +// "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +// }; - private readonly ILogger _logger; +// private readonly ILogger _logger; - public WeatherForecastController(ILogger logger, KafkaAdminService kafkaAdminService) - { - _logger = logger; - _servicekafkaAdmin = kafkaAdminService; - } +// public WeatherForecastController(ILogger logger, KafkaAdminService kafkaAdminService) +// { +// _logger = logger; +// _servicekafkaAdmin = kafkaAdminService; +// } - //[HttpGet(Name = "GetWeatherForecast")] - //public IEnumerable Get() - //{ - // return Enumerable.Range(1, 5).Select(index => new WeatherForecast - // { - // Date = DateTime.Now.AddDays(index), - // TemperatureC = Random.Shared.Next(-20, 55), - // Summary = Summaries[Random.Shared.Next(Summaries.Length)] - // }) - // .ToArray(); - //} - //[HttpGet(Name = "GetGroup")] - //public ApiResponse> GetGroup() - //{ - // var group = _servicekafkaAdmin.ListGroups(); - // return ApiResponse>.Success(group); - //} +// //[HttpGet(Name = "GetWeatherForecast")] +// //public IEnumerable Get() +// //{ +// // return Enumerable.Range(1, 5).Select(index => new WeatherForecast +// // { +// // Date = DateTime.Now.AddDays(index), +// // TemperatureC = Random.Shared.Next(-20, 55), +// // Summary = Summaries[Random.Shared.Next(Summaries.Length)] +// // }) +// // .ToArray(); +// //} +// //[HttpGet(Name = "GetGroup")] +// //public ApiResponse> GetGroup() +// //{ +// // var group = _servicekafkaAdmin.ListGroups(); +// // return ApiResponse>.Success(group); +// //} - [HttpGet(Name = "GetGroup")] - public async Task> GetGroupAsync() - { - // var group = _servicekafkaAdmin.ListGroups(); - List aclBindings = new() - { - new AclBinding() - { - Pattern = new ResourcePattern - { - Type = ResourceType.Broker, - Name = "kafka-cluster", - ResourcePatternType = ResourcePatternType.Literal - }, - Entry = new AccessControlEntry - { - Principal = $"User:telpo-consumer", - Host = "*", - Operation = AclOperation.All, - PermissionType = AclPermissionType.Deny - } - } - }; - await _servicekafkaAdmin.CreateAclsAsync(aclBindings); - return ApiResponse.Success("ok"); - } - } -} +// [HttpGet(Name = "GetGroup")] +// public async Task> GetGroupAsync() +// { +// // var group = _servicekafkaAdmin.ListGroups(); +// List aclBindings = new() +// { +// new AclBinding() +// { +// Pattern = new ResourcePattern +// { +// Type = ResourceType.Broker, +// Name = "kafka-cluster", +// ResourcePatternType = ResourcePatternType.Literal +// }, +// Entry = new AccessControlEntry +// { +// Principal = $"User:telpo-consumer", +// Host = "*", +// Operation = AclOperation.All, +// PermissionType = AclPermissionType.Deny +// } +// } +// }; +// await _servicekafkaAdmin.CreateAclsAsync(aclBindings); +// return ApiResponse.Success("ok"); +// } +// } +//}