[성현모] KMS 서비스 기능 추가

This commit is contained in:
SHM
2026-02-02 10:14:43 +09:00
parent cfc36e80d4
commit e673cc20cf
5 changed files with 165 additions and 54 deletions

View File

@ -1,6 +1,55 @@
namespace WebApi.Project.ProxyKMS.Services
using System;
using System.Runtime.CompilerServices;
using SystemX.Core.DB;
using SystemX.Core.Services;
using WebApi.Library.Enums;
using WebApi.Project.ProxyKMS.Models;
namespace WebApi.Project.ProxyKMS.Services
{
public class KmsService
public class KmsService : HttpService
{
private readonly IServiceScopeFactory _scopeFactory;
private readonly ConfigService<ProxyKMSConfig>? _configService;
private API KmsApi = new API();
public KmsService(IServiceProvider serviceProvider, IServiceScopeFactory scopeFactory, ConfigService<ProxyKMSConfig> configSerice)
{
_scopeFactory = scopeFactory;
_configService = configSerice;
KmsApi = _configService.GetConfig().API.Find(x=>x.ApiName.ToLower() == "kms");
}
public async Task<RESPONSE?> PostKms<REQUEST,RESPONSE>(REQUEST request, string guid = "", [CallerMemberName] string memberName = "") where REQUEST : class where RESPONSE : class
{
RESPONSE? response = default(RESPONSE);
LogXnet.WriteLine($"KmsService.PostKms::{memberName}", LogXLabel.Debug);
if (request != null)
{
var function = KmsApi.Functions.Find(x => x.Name == memberName);
response = await PostJsonAsync<REQUEST, RESPONSE>($"{function.Url}", request);
}
return response;
}
public async Task<RESPONSE?> PutKms<REQUEST, RESPONSE>(REQUEST request, string guid = "", [CallerMemberName] string memberName = "") where REQUEST : class where RESPONSE : class
{
RESPONSE? response = default(RESPONSE);
LogXnet.WriteLine($"KmsService.PutKms::{memberName}", LogXLabel.Debug);
if (request != null)
{
var function = KmsApi.Functions.Find(x => x.Name == memberName);
response = await PutJsonAsync<REQUEST, RESPONSE>($"{function.Url}", request);
}
return response;
}
}
}