Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add CDK outputs for mock billing related resources #114

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/control-plane/billing/mock-billing-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ export class MockBillingProvider extends Construct implements IBilling {
pointInTimeRecovery: true,
});

new cdk.CfnOutput(this, 'BillingTableName', {
value: this.billingTable.tableName,
});

// Create DynamoDB table for customer records
this.customersTable = new dynamodb.Table(this, 'CustomersTable', {
partitionKey: { name: 'customerId', type: dynamodb.AttributeType.STRING },
billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
pointInTimeRecovery: true,
});

new cdk.CfnOutput(this, 'CustomersTableName', {
value: this.customersTable.tableName,
});

// Add a global secondary index on the tenantId field
const tenantIndexName = 'TenantIndex';
this.customersTable.addGlobalSecondaryIndex({
Expand All @@ -55,6 +63,10 @@ export class MockBillingProvider extends Construct implements IBilling {
autoDeleteObjects: true,
});

new cdk.CfnOutput(this, 'IngestorTableName', {
value: this.ingestor.dataRepository.tableName,
});

// https://docs.powertools.aws.dev/lambda/python/2.31.0/#lambda-layer
this.lambdaPowertoolsLayer = lambda_python.PythonLayerVersion.fromLayerVersionArn(
this,
Expand All @@ -75,6 +87,11 @@ export class MockBillingProvider extends Construct implements IBilling {

// Create PutUsage function
const putUsageHandler = this.createPythonFunction('PutUsage', 'put-usage');

new cdk.CfnOutput(this, 'PutUsageFunctionName', {
value: putUsageHandler.functionName,
});

this.putUsageFunction = {
handler: putUsageHandler,
schedule: cdk.aws_events.Schedule.rate(cdk.Duration.hours(24)),
Expand Down
Loading