Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2014 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 DescribeAlarms operation.

Retrieves alarms with the specified names. If no name is specified, all alarms for the user are returned. Alarms can be retrieved by using only a prefix for the alarm name, the alarm state, or a prefix for any action.

 
 public class DescribeAlarmsRequest extends AmazonWebServiceRequest implements Serializable {

    
A list of alarm names to retrieve information for.

Constraints:
Length: 0 - 100

 
The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.

Constraints:
Length: 1 - 255

 
     private String alarmNamePrefix;

    
The state value to be used in matching alarms.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

 
     private String stateValue;

    
The action name prefix.

Constraints:
Length: 1 - 1024

 
     private String actionPrefix;

    
The maximum number of alarm descriptions to retrieve.

Constraints:
Range: 1 - 100

 
     private Integer maxRecords;

    
The token returned by a previous call to indicate that there is more data available.
 
     private String nextToken;

    
A list of alarm names to retrieve information for.

Constraints:
Length: 0 - 100

Returns:
A list of alarm names to retrieve information for.
 
     public java.util.List<StringgetAlarmNames() {
         if ( == null) {
                = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
               .setAutoConstruct(true);
         }
         return ;
     }
    
    
A list of alarm names to retrieve information for.

Constraints:
Length: 0 - 100

Parameters:
alarmNames A list of alarm names to retrieve information for.
    public void setAlarmNames(java.util.Collection<StringalarmNames) {
        if (alarmNames == null) {
            this. = null;
            return;
        }
        alarmNamesCopy.addAll(alarmNames);
        this. = alarmNamesCopy;
    }
    
    
A list of alarm names to retrieve information for.

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

Constraints:
Length: 0 - 100

Parameters:
alarmNames A list of alarm names to retrieve information for.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DescribeAlarmsRequest withAlarmNames(String... alarmNames) {
        if (getAlarmNames() == nullsetAlarmNames(new java.util.ArrayList<String>(alarmNames.length));
        for (String value : alarmNames) {
            getAlarmNames().add(value);
        }
        return this;
    }
    
    
A list of alarm names to retrieve information for.

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

Constraints:
Length: 0 - 100

Parameters:
alarmNames A list of alarm names to retrieve information for.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (alarmNames == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringalarmNamesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(alarmNames.size());
            alarmNamesCopy.addAll(alarmNames);
            this. = alarmNamesCopy;
        }
        return this;
    }

    
The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.

Constraints:
Length: 1 - 255

Returns:
The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.
    public String getAlarmNamePrefix() {
        return ;
    }
    
    
The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.

Constraints:
Length: 1 - 255

Parameters:
alarmNamePrefix The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.
    public void setAlarmNamePrefix(String alarmNamePrefix) {
        this. = alarmNamePrefix;
    }
    
    
The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.

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

Constraints:
Length: 1 - 255

Parameters:
alarmNamePrefix The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DescribeAlarmsRequest withAlarmNamePrefix(String alarmNamePrefix) {
        this. = alarmNamePrefix;
        return this;
    }

    
The state value to be used in matching alarms.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

Returns:
The state value to be used in matching alarms.
See also:
StateValue
    public String getStateValue() {
        return ;
    }
    
    
The state value to be used in matching alarms.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

Parameters:
stateValue The state value to be used in matching alarms.
See also:
StateValue
    public void setStateValue(String stateValue) {
        this. = stateValue;
    }
    
    
The state value to be used in matching alarms.

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

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

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

    
The state value to be used in matching alarms.

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

Parameters:
stateValue The state value to be used in matching alarms.
See also:
StateValue
    public void setStateValue(StateValue stateValue) {
        this. = stateValue.toString();
    }
    
    
The state value to be used in matching alarms.

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

Constraints:
Allowed Values: OK, ALARM, INSUFFICIENT_DATA

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

    
The action name prefix.

Constraints:
Length: 1 - 1024

Returns:
The action name prefix.
    public String getActionPrefix() {
        return ;
    }
    
    
The action name prefix.

Constraints:
Length: 1 - 1024

Parameters:
actionPrefix The action name prefix.
    public void setActionPrefix(String actionPrefix) {
        this. = actionPrefix;
    }
    
    
The action name prefix.

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

Constraints:
Length: 1 - 1024

Parameters:
actionPrefix The action name prefix.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DescribeAlarmsRequest withActionPrefix(String actionPrefix) {
        this. = actionPrefix;
        return this;
    }

    
The maximum number of alarm descriptions to retrieve.

Constraints:
Range: 1 - 100

Returns:
The maximum number of alarm descriptions to retrieve.
    public Integer getMaxRecords() {
        return ;
    }
    
    
The maximum number of alarm descriptions to retrieve.

Constraints:
Range: 1 - 100

Parameters:
maxRecords The maximum number of alarm descriptions to retrieve.
    public void setMaxRecords(Integer maxRecords) {
        this. = maxRecords;
    }
    
    
The maximum number of alarm descriptions to retrieve.

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

Constraints:
Range: 1 - 100

Parameters:
maxRecords The maximum number of alarm descriptions to retrieve.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DescribeAlarmsRequest withMaxRecords(Integer maxRecords) {
        this. = maxRecords;
        return this;
    }

    
The token returned by a previous call to indicate that there is more data available.

Returns:
The token returned by a previous call to indicate that there is more data available.
    public String getNextToken() {
        return ;
    }
    
    
The token returned by a previous call to indicate that there is more data available.

Parameters:
nextToken The token returned by a previous call to indicate that there is more data available.
    public void setNextToken(String nextToken) {
        this. = nextToken;
    }
    
    
The token returned by a previous call to indicate that there is more data available.

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

Parameters:
nextToken The token returned by a previous call to indicate that there is more data available.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DescribeAlarmsRequest withNextToken(String nextToken) {
        this. = nextToken;
        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 (getAlarmNames() != nullsb.append("AlarmNames: " + getAlarmNames() + ",");
        if (getAlarmNamePrefix() != nullsb.append("AlarmNamePrefix: " + getAlarmNamePrefix() + ",");
        if (getStateValue() != nullsb.append("StateValue: " + getStateValue() + ",");
        if (getActionPrefix() != nullsb.append("ActionPrefix: " + getActionPrefix() + ",");
        if (getMaxRecords() != nullsb.append("MaxRecords: " + getMaxRecords() + ",");
        if (getNextToken() != nullsb.append("NextToken: " + getNextToken() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getAlarmNames() == null) ? 0 : getAlarmNames().hashCode()); 
        hashCode = prime * hashCode + ((getAlarmNamePrefix() == null) ? 0 : getAlarmNamePrefix().hashCode()); 
        hashCode = prime * hashCode + ((getStateValue() == null) ? 0 : getStateValue().hashCode()); 
        hashCode = prime * hashCode + ((getActionPrefix() == null) ? 0 : getActionPrefix().hashCode()); 
        hashCode = prime * hashCode + ((getMaxRecords() == null) ? 0 : getMaxRecords().hashCode()); 
        hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof DescribeAlarmsRequest == falsereturn false;
        DescribeAlarmsRequest other = (DescribeAlarmsRequest)obj;
        
        if (other.getAlarmNames() == null ^ this.getAlarmNames() == nullreturn false;
        if (other.getAlarmNames() != null && other.getAlarmNames().equals(this.getAlarmNames()) == falsereturn false
        if (other.getAlarmNamePrefix() == null ^ this.getAlarmNamePrefix() == nullreturn false;
        if (other.getAlarmNamePrefix() != null && other.getAlarmNamePrefix().equals(this.getAlarmNamePrefix()) == falsereturn false
        if (other.getStateValue() == null ^ this.getStateValue() == nullreturn false;
        if (other.getStateValue() != null && other.getStateValue().equals(this.getStateValue()) == falsereturn false
        if (other.getActionPrefix() == null ^ this.getActionPrefix() == nullreturn false;
        if (other.getActionPrefix() != null && other.getActionPrefix().equals(this.getActionPrefix()) == falsereturn false
        if (other.getMaxRecords() == null ^ this.getMaxRecords() == nullreturn false;
        if (other.getMaxRecords() != null && other.getMaxRecords().equals(this.getMaxRecords()) == falsereturn false
        if (other.getNextToken() == null ^ this.getNextToken() == nullreturn false;
        if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == falsereturn false
        return true;
    }
    
}
    
New to GrepCode? Check out our FAQ X