Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.cloudwatch.model;
 
 
Container for the parameters to the SetAlarmState operation.

Temporarily sets the state of an alarm. When the updated StateValue differs from the previous value, the action configured for the appropriate state is invoked. This is not a permanent change. The next periodic alarm check (in about a minute) will set the alarm to its actual state.

 
 public class SetAlarmStateRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.

Constraints:
Length: 1 - 255

 
     private String alarmName;

    
The value of the state.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

 
     private String stateValue;

    
The reason that this alarm is set to this specific state (in human-readable text format)

Constraints:
Length: 0 - 1023

 
     private String stateReason;

    
The reason that this alarm is set to this specific state (in machine-readable JSON format)

Constraints:
Length: 0 - 4000

 
     private String stateReasonData;

    
The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.

Constraints:
Length: 1 - 255

Returns:
The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.
 
     public String getAlarmName() {
         return ;
     }
    
    
The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.

Constraints:
Length: 1 - 255

Parameters:
alarmName The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.
 
     public void setAlarmName(String alarmName) {
         this. = alarmName;
     }
    
    
The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 255

Parameters:
alarmName The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.
Returns:
A reference to this updated object so that method calls can be chained together.
    public SetAlarmStateRequest withAlarmName(String alarmName) {
        this. = alarmName;
        return this;
    }

    
The value of the state.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

Returns:
The value of the state.
See also:
StateValue
    public String getStateValue() {
        return ;
    }
    
    
The value of the state.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

Parameters:
stateValue The value of the state.
See also:
StateValue
    public void setStateValue(String stateValue) {
        this. = stateValue;
    }
    
    
The value of the state.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

Parameters:
stateValue The value of the state.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
StateValue
    public SetAlarmStateRequest withStateValue(String stateValue) {
        this. = stateValue;
        return this;
    }

    
The value of the state.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

Parameters:
stateValue The value of the state.
See also:
StateValue
    public void setStateValue(StateValue stateValue) {
        this. = stateValue.toString();
    }
    
    
The value of the state.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

Parameters:
stateValue The value of the state.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
StateValue
    public SetAlarmStateRequest withStateValue(StateValue stateValue) {
        this. = stateValue.toString();
        return this;
    }

    
The reason that this alarm is set to this specific state (in human-readable text format)

Constraints:
Length: 0 - 1023

Returns:
The reason that this alarm is set to this specific state (in human-readable text format)
    public String getStateReason() {
        return ;
    }
    
    
The reason that this alarm is set to this specific state (in human-readable text format)

Constraints:
Length: 0 - 1023

Parameters:
stateReason The reason that this alarm is set to this specific state (in human-readable text format)
    public void setStateReason(String stateReason) {
        this. = stateReason;
    }
    
    
The reason that this alarm is set to this specific state (in human-readable text format)

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 0 - 1023

Parameters:
stateReason The reason that this alarm is set to this specific state (in human-readable text format)
Returns:
A reference to this updated object so that method calls can be chained together.
    public SetAlarmStateRequest withStateReason(String stateReason) {
        this. = stateReason;
        return this;
    }

    
The reason that this alarm is set to this specific state (in machine-readable JSON format)

Constraints:
Length: 0 - 4000

Returns:
The reason that this alarm is set to this specific state (in machine-readable JSON format)
    public String getStateReasonData() {
        return ;
    }
    
    
The reason that this alarm is set to this specific state (in machine-readable JSON format)

Constraints:
Length: 0 - 4000

Parameters:
stateReasonData The reason that this alarm is set to this specific state (in machine-readable JSON format)
    public void setStateReasonData(String stateReasonData) {
        this. = stateReasonData;
    }
    
    
The reason that this alarm is set to this specific state (in machine-readable JSON format)

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 0 - 4000

Parameters:
stateReasonData The reason that this alarm is set to this specific state (in machine-readable JSON format)
Returns:
A reference to this updated object so that method calls can be chained together.
    public SetAlarmStateRequest withStateReasonData(String stateReasonData) {
        this. = stateReasonData;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAlarmName() != nullsb.append("AlarmName: " + getAlarmName() + ",");
        if (getStateValue() != nullsb.append("StateValue: " + getStateValue() + ",");
        if (getStateReason() != nullsb.append("StateReason: " + getStateReason() + ",");
        if (getStateReasonData() != nullsb.append("StateReasonData: " + getStateReasonData() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getAlarmName() == null) ? 0 : getAlarmName().hashCode()); 
        hashCode = prime * hashCode + ((getStateValue() == null) ? 0 : getStateValue().hashCode()); 
        hashCode = prime * hashCode + ((getStateReason() == null) ? 0 : getStateReason().hashCode()); 
        hashCode = prime * hashCode + ((getStateReasonData() == null) ? 0 : getStateReasonData().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof SetAlarmStateRequest == falsereturn false;
        SetAlarmStateRequest other = (SetAlarmStateRequest)obj;
        
        if (other.getAlarmName() == null ^ this.getAlarmName() == nullreturn false;
        if (other.getAlarmName() != null && other.getAlarmName().equals(this.getAlarmName()) == falsereturn false
        if (other.getStateValue() == null ^ this.getStateValue() == nullreturn false;
        if (other.getStateValue() != null && other.getStateValue().equals(this.getStateValue()) == falsereturn false
        if (other.getStateReason() == null ^ this.getStateReason() == nullreturn false;
        if (other.getStateReason() != null && other.getStateReason().equals(this.getStateReason()) == falsereturn false
        if (other.getStateReasonData() == null ^ this.getStateReasonData() == nullreturn false;
        if (other.getStateReasonData() != null && other.getStateReasonData().equals(this.getStateReasonData()) == falsereturn false
        return true;
    }
    
    @Override
    public SetAlarmStateRequest clone() {
        
            return (SetAlarmStateRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X