Skip to content

@sourceloop/ctrl-plane-tenant-management-service / Exports / ProvisioningService

Class: ProvisioningService<T>

Service for provisioning tenants.

Type parameters

Name Type
T extends SubscriptionDTO

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ProvisioningService<T>(cryptoHelperService, eventConnector, webhookSecretRepo, tenantRepository, logger)

Constructs a new instance of the ProvisioningService.

Type parameters

Name Type
T extends SubscriptionDTO<T>

Parameters

Name Type Description
cryptoHelperService CryptoHelperService Service for cryptographic operations.
eventConnector EventConnector Event Connector provided by consumer to invoke publish on.
webhookSecretRepo WebhookSecretRepository Repository for webhook secrets.
tenantRepository TenantRepository -
logger ILogger Logger service for logging messages.

Defined in

services/tenant-management-service/src/services/provisioning.service.ts:26

Properties

cryptoHelperService

Private cryptoHelperService: CryptoHelperService

Service for cryptographic operations.

Defined in

services/tenant-management-service/src/services/provisioning.service.ts:28


eventConnector

Private eventConnector: EventConnector

Event Connector provided by consumer to invoke publish on.

Defined in

services/tenant-management-service/src/services/provisioning.service.ts:30


logger

Private logger: ILogger

Logger service for logging messages.

Defined in

services/tenant-management-service/src/services/provisioning.service.ts:36


tenantRepository

Private tenantRepository: TenantRepository

Defined in

services/tenant-management-service/src/services/provisioning.service.ts:34


webhookSecretRepo

Private webhookSecretRepo: WebhookSecretRepository

Repository for webhook secrets.

Defined in

services/tenant-management-service/src/services/provisioning.service.ts:32

Methods

provisionTenant

provisionTenant(tenant, subscription): Promise<void>

The provisionTenant function provisions a new tenant by generating a temporary token, retrieving the subscription details, generating a random HMAC secret, starting a build process, and storing the webhook secret and build context to later verify the webhook callback.

Parameters

Name Type Description
tenant TenantWithRelations The tenant parameter is an object that represents a tenant. It likely contains information such as the tenant's ID, name, and other relevant details.
subscription T The subscription parameter is an object that contains the details of the subscription opted by the tenant.

Returns

Promise<void>

Implementation of

IProvisioningService.provisionTenant

Defined in

services/tenant-management-service/src/services/provisioning.service.ts:48