From 811f19d44d9f09c293fc96f414a6e27676dc3e44 Mon Sep 17 00:00:00 2001 From: Cristhian Fuertes Date: Thu, 8 Feb 2024 09:49:19 -0500 Subject: [PATCH] ENG-54002: implementing mapping endpoint and type (#354) --- package.json | 2 +- src/aims-client/aims-client.ts | 14 ++++++++++++++ src/aims-client/types/types.ts | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b59eea..a25d9f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@al/core", - "version": "1.2.21", + "version": "1.2.22", "description": "Node Enterprise Packages for Alert Logic (NEPAL) Core Library", "main": "./dist/index.cjs.js", "types": "./dist/index.d.ts", diff --git a/src/aims-client/aims-client.ts b/src/aims-client/aims-client.ts index eb8c970..58b1f60 100644 --- a/src/aims-client/aims-client.ts +++ b/src/aims-client/aims-client.ts @@ -24,6 +24,7 @@ import { AIMSUserDetails, AIMSEnrollURI, AIMSLicenseAcceptanceStatus, + AIMSMappedAccount, } from './types'; import { aimsTypeSchematics } from './aims.schematics'; @@ -899,6 +900,19 @@ export class AIMSClientInstance implements AlValidationSchemaProvider { } ); } + /** + * Retrieves the mapped account given an account ID + * @param accountId ALert Logic's account ID + */ + async getMappedAccount(accountId: string): Promise { + return await this.client.get({ + service_stack: AlLocation.InsightAPI, + service_name: this.serviceName, + version: this.serviceVersion, + path: `/${accountId}/mapping` + }) + } + /** * Triggers Frontline PCI scan migration for a given account. */ diff --git a/src/aims-client/types/types.ts b/src/aims-client/types/types.ts index 2cd115a..61750e6 100644 --- a/src/aims-client/types/types.ts +++ b/src/aims-client/types/types.ts @@ -1,5 +1,12 @@ import { AlChangeStamp } from '../../types'; +export interface AIMSMappedAccount { + alertlogic_account: string; + frontline_account: string; + created: AlChangeStamp; + modified: AlChangeStamp; +} + export interface AIMSAuthentication { user: AIMSUser; account: AIMSAccount;