12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using AipGateway.API.Application;
- using AipGateway.API.Application.Interfaces.Services;
- using AipGateway.API.Domain.Models.Response;
- using AipGateway.AIP.Service.Services.Interfaces;
- namespace AipGateway.AIP.Service.Services
- {
- public class ApiAipService : BaseService, IApiAipService
- {
- private readonly ILogger<ApiAipService> _log;
- public ApiAipService(ILogger<ApiAipService> log, IAipFileService aipFileService)
- : base(aipFileService)
- {
- _log = log;
- }
- public async Task<GeneralResponse> DownloadAipInfo()
- {
- try
- {
- var task = Task.Run(() =>
- {
- int result = _aipFileService.DownloadAipFileInformations();
- return result;
- });
- int result = await task;
- return new GeneralResponse
- {
- errorCode = 0,
- errorMessage = GlobalConstants.API_RESULT_SUCCESS,
- effectCount = result,
- };
- }
- catch (Exception e)
- {
- _log.LogError($"{e}");
- throw;
- }
- }
- public async Task<List<AipLabel>> GetLabels()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return _aipFileService.aipFileManager.SensitivityLabels();
- });
- List<AipLabel> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<AipLabel>> GetPolicies()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return _aipFileService.aipFileManager.ListSensitivityLabels();
- });
- List<AipLabel> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<AipTemplate>> GetProtections()
- {
- try
- {
- var task = Task.Run(() =>
- {
- return _aipFileService.aipFileManager.GetTemplates();
- });
- List<AipTemplate> result = await task;
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
- }
|