123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- using AipGateway.AIP;
- using AipGateway.API.Application.Modules;
- using AipGateway.API.Domain.Models;
- namespace AipGateway.API.Services.impl
- {
- public class ApiAipService : IApiAipService
- {
- private readonly ILogger<ApiFileService> _log;
- private readonly IServiceProvider _provider;
- public ApiAipService(ILogger<ApiFileService> logger, IServiceProvider provider)
- {
- _log = logger;
- _provider = provider;
- _log.LogError("ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo: ApiAipService");
- }
- public async Task<ApiResponseDto> DownloadAipInfo()
- {
- try
- {
- //AipFileApiService? aipFileApiService = ContainerService.provider.GetService<AipFileApiService>();
- AipFileApiService? aipFileApiService = _provider.GetService<AipFileApiService>();
- if (aipFileApiService == null)
- {
- return new ApiResponseDto
- {
- errorCode = 1,
- errorMessage = "AIP File 관리 서비스를 찾을 수 없습니다.",
- effectCount = 0,
- };
- }
- var task = Task.Run(() =>
- {
- aipFileApiService.DownloadAipFileInformations();
- return ContainerService.aipLableMap.Count + ContainerService.aipPolicyMap.Count + ContainerService.aipProtectionMap.Count;
- });
- int result = await task;
- return new ApiResponseDto
- {
- errorCode = 0,
- errorMessage = GlobalConstants.API_RESULT_SUCCESS,
- effectCount = result,
- };
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<AipLabel>> GetLabels()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return ContainerService.aipFileManager.SensitivityLabels();
- });
- List<AipLabel> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<AipLabel>> GetPolicies()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return ContainerService.aipFileManager.ListSensitivityLabels();
- });
- List<AipLabel> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<AipTemplate>> GetProtections()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return ContainerService.aipFileManager.GetTemplates();
- });
- List<AipTemplate> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
- }
|