import { SSMClient, GetParameterCommand } from '@aws-sdk/client-ssm'; import { verboseLog } from 'ic-logs'; import configuration from '../aws/configuration'; import { ILoginParameters } from '../interfaces/ILoginParameters'; export const ssm = new SSMClient({ region: `${configuration.REGION}` }); export class ParameterStoreService { private parameter_name: string; constructor() { this.parameter_name = `/${configuration.ENVIRONMENT}/${configuration.TENANT}/core/login`; } async getPartnerParameters(): Promise { verboseLog(`PARAMETER_NAME: ${this.parameter_name}`); const parameter_store = ssm; const input = { Name: this.parameter_name, WithDecryption: false, }; const command = new GetParameterCommand(input); try { const data = await parameter_store.send(command); const response = JSON.parse(data.Parameter.Value); return response; } catch (error) { return error; } } }