public TestAlarmRequest withState(AlarmState state) {
        this.state = state.toString();
        return this;
    }
<p>
The alarm state to test.
</p>
<p>
An alarm has the following possible states that can be tested:
</p>
<ul>
<li>
<p>
<code>ALARM</code> - The metric is outside of the defined threshold.
</p>
</li>
<li>
<p>
<code>INSUFFICIENT_DATA</code> - The alarm has just started, the metric is not available, or not enough data is
available for the metric to determine the alarm state.
</p>
</li>
<li>
<p>
<code>OK</code> - The metric is within the defined threshold.
</p>
</li>
</ul>

@param state
       The alarm state to test.</p>
       <p>
       An alarm has the following possible states that can be tested:
       </p>
       <ul>
       <li>
       <p>
       <code>ALARM</code> - The metric is outside of the defined threshold.
       </p>
       </li>
       <li>
       <p>
       <code>INSUFFICIENT_DATA</code> - The alarm has just started, the metric is not available, or not enough
       data is available for the metric to determine the alarm state.
       </p>
       </li>
       <li>
       <p>
       <code>OK</code> - The metric is within the defined threshold.
       </p>
       </li>
@return Returns a reference to this object so that method calls can be chained together.
@see AlarmState
aws-java-sdk-lightsail/src/main/java/com/amazonaws/services/lightsail/model/TestAlarmRequest.java