Class FaultInjectionRuleBuilder

java.lang.Object
com.azure.cosmos.test.faultinjection.FaultInjectionRuleBuilder

public final class FaultInjectionRuleBuilder extends Object
The fault injection rule builder.
  • Constructor Details

    • FaultInjectionRuleBuilder

      public FaultInjectionRuleBuilder(String id)
      The constructor.
      Parameters:
      id - the fault injection rule id.
  • Method Details

    • condition

      public FaultInjectionRuleBuilder condition(FaultInjectionCondition condition)
      Set the condition of the rule. The rule will not be applicable if not all conditions are met.
      Parameters:
      condition - the FaultInjectionCondition.
      Returns:
      the builder.
    • result

      public FaultInjectionRuleBuilder result(IFaultInjectionResult faultInjectionResult)
      Set the result of the rule.
      Parameters:
      faultInjectionResult - the IFaultInjectionResult.
      Returns:
      the builder.
    • duration

      public FaultInjectionRuleBuilder duration(Duration duration)
      Set the effective duration of the rule. The rule will not be applicable if after the effective duration. By default, it is null which means it will be effective until the end of the application.
      Parameters:
      duration - the effective duration.
      Returns:
      the builder.
    • startDelay

      public FaultInjectionRuleBuilder startDelay(Duration startDelay)
      Set the start time of the rule. The rule will not be applicable before the start time. By default, it is null which means the rule will be effective right away.
      Parameters:
      startDelay - the delay of the rule.
      Returns:
      the builder.
    • hitLimit

      public FaultInjectionRuleBuilder hitLimit(int hitLimit)
      Set the total hit limit of the rule. The rule will be not applicable anymore once it has applied hitLimit times. By default, it is null which means there is no limit.
      Parameters:
      hitLimit - the hit limit.
      Returns:
      the builder.
    • enabled

      public FaultInjectionRuleBuilder enabled(boolean enabled)
      Flag to indicate whether the rule is enabled. The rule will not be applicable if it is disabled. A rule can be disabled/enable multiple times. By default, it is enabled.
      Parameters:
      enabled - flag to indicate whether the rule is enabled.
      Returns:
      the builder.
    • build

      public FaultInjectionRule build()
      Create a new fault injection rule.
      Returns:
      the FaultInjectionRule.