All files / src/rabbitmq rabbitmq-broker-configuration-definition.ts

82.35% Statements 28/34
100% Branches 3/3
75% Functions 3/4
82.35% Lines 28/34

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 341x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 1x 1x             1x 1x 1x 1x 4x 4x 1x 1x 4x 4x 1x
/*
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
import { Duration } from 'aws-cdk-lib';
 
/// TODO: think if it should be parameters or maybe properties?
export interface RabbitMqBrokerConfigurationParameters {
  readonly consumerTimeout: Duration;
}
 
export class RabbitMqBrokerConfigurationDefinition {
  public static data(data: string) {
    return new RabbitMqBrokerConfigurationDefinition(data);
  }
 
  public static parameters(parameters: RabbitMqBrokerConfigurationParameters) {
    return new RabbitMqBrokerConfigurationDefinition(
      `consumer_timeout = ${parameters.consumerTimeout.toMilliseconds({
        integral: true,
      })}`,
    );
  }
 
  private readonly data: string;
 
  protected constructor(data: string) {
    this.data = data;
  }
 
  public toString() {
    return this.data;
  }
}