@sourceloop/ctrl-plane-tenant-management-service
Version:
Tenant Management microservice for SaaS control plane
40 lines (39 loc) • 2.37 kB
TypeScript
import { ILogger } from '@sourceloop/core';
import { WebhookType } from '../../enums/webhook-types.enum';
import { ResourceRepository, TenantRepository } from '../../repositories';
import { IWebhookHandler, ResourceProvisionedWebhookPayload } from '../../types';
import { CryptoHelperService } from '../crypto-helper.service';
import { NotificationService } from '../notifications';
import { IPostWebhookHandlerService } from '../../types/i-post-webhook-handler-service.interface';
/**
* Handler for provisioning webhooks.
* This class implements the IWebhookHandler interface and defines the type of webhook it handles
* as `WebhookType.RESOURCES_PROVISIONED`. It provides functionality to handle a webhook payload
* for resource provisioning, updating the status of a tenant and creating resources associated with the tenant.
*/
export declare class ProvisioningWebhookHandler implements IWebhookHandler {
resourceRepository: ResourceRepository;
tenantRepository: TenantRepository;
private notificationService;
private postWebhookHandlerService;
private cryptoHelperService;
private readonly logger;
type: WebhookType;
/**
* Constructs a new instance of the ProvisioningWebhookHandler.
* @param {ResourceRepository} resourceRepository - Repository for managing resources.
* @param {TenantRepository} tenantRepository - Repository for managing tenants.
* @param {NotificationService} notificationService - Service for sending notifications.
* @param {CryptoHelperService} cryptoHelperService - Service for cryptographic operations.
* @param {ILogger} logger - Logger service for logging messages.
*/
constructor(resourceRepository: ResourceRepository, tenantRepository: TenantRepository, notificationService: NotificationService, postWebhookHandlerService: IPostWebhookHandlerService<ResourceProvisionedWebhookPayload>, cryptoHelperService: CryptoHelperService, logger: ILogger);
/**
* This function handles a webhook payload for resource provisioning, updating the status of a tenant
* and creating resources associated with the tenant.
* @param {ResourceProvisionedWebhookPayload} payload - The payload parameter is of type
* ResourceProvisionedWebhookPayload.
*/
handle(payload: ResourceProvisionedWebhookPayload): Promise<void>;
private _sendEmail;
}