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 DescribeAlarmsForMetric operation.

Retrieves all alarms for a single metric. Specify a statistic, period, or unit to filter the set of alarms further.

 
 public class DescribeAlarmsForMetricRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The name of the metric.

Constraints:
Length: 1 - 255

 
     private String metricName;

    
The namespace of the metric.

Constraints:
Length: 1 - 255
Pattern: [^:].*

 
     private String namespace;

    
The statistic for the metric.

Constraints:
Allowed Values: SampleCount, Average, Sum, Minimum, Maximum

 
     private String statistic;

    
The list of dimensions associated with the metric.

Constraints:
Length: 0 - 10

 
The period in seconds over which the statistic is applied.

Constraints:
Range: 60 -

 
     private Integer period;

    
The unit for the metric.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

 
     private String unit;

    
The name of the metric.

Constraints:
Length: 1 - 255

Returns:
The name of the metric.
 
     public String getMetricName() {
         return ;
     }
    
    
The name of the metric.

Constraints:
Length: 1 - 255

Parameters:
metricName The name of the metric.
    public void setMetricName(String metricName) {
        this. = metricName;
    }
    
    
The name of the metric.

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

Constraints:
Length: 1 - 255

Parameters:
metricName The name of the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = metricName;
        return this;
    }

    
The namespace of the metric.

Constraints:
Length: 1 - 255
Pattern: [^:].*

Returns:
The namespace of the metric.
    public String getNamespace() {
        return ;
    }
    
    
The namespace of the metric.

Constraints:
Length: 1 - 255
Pattern: [^:].*

Parameters:
namespace The namespace of the metric.
    public void setNamespace(String namespace) {
        this. = namespace;
    }
    
    
The namespace of the metric.

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

Constraints:
Length: 1 - 255
Pattern: [^:].*

Parameters:
namespace The namespace of the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = namespace;
        return this;
    }

    
The statistic for the metric.

Constraints:
Allowed Values: SampleCount, Average, Sum, Minimum, Maximum

Returns:
The statistic for the metric.
See also:
Statistic
    public String getStatistic() {
        return ;
    }
    
    
The statistic for the metric.

Constraints:
Allowed Values: SampleCount, Average, Sum, Minimum, Maximum

Parameters:
statistic The statistic for the metric.
See also:
Statistic
    public void setStatistic(String statistic) {
        this. = statistic;
    }
    
    
The statistic for the metric.

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

Constraints:
Allowed Values: SampleCount, Average, Sum, Minimum, Maximum

Parameters:
statistic The statistic for the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
Statistic
        this. = statistic;
        return this;
    }

    
The statistic for the metric.

Constraints:
Allowed Values: SampleCount, Average, Sum, Minimum, Maximum

Parameters:
statistic The statistic for the metric.
See also:
Statistic
    public void setStatistic(Statistic statistic) {
        this. = statistic.toString();
    }
    
    
The statistic for the metric.

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

Constraints:
Allowed Values: SampleCount, Average, Sum, Minimum, Maximum

Parameters:
statistic The statistic for the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
Statistic
        this. = statistic.toString();
        return this;
    }

    
The list of dimensions associated with the metric.

Constraints:
Length: 0 - 10

Returns:
The list of dimensions associated with the metric.
    public java.util.List<DimensiongetDimensions() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Dimension>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The list of dimensions associated with the metric.

Constraints:
Length: 0 - 10

Parameters:
dimensions The list of dimensions associated with the metric.
    public void setDimensions(java.util.Collection<Dimensiondimensions) {
        if (dimensions == null) {
            this. = null;
            return;
        }
        dimensionsCopy.addAll(dimensions);
        this. = dimensionsCopy;
    }
    
    
The list of dimensions associated with the metric.

NOTE: This method appends the values to the existing list (if any). Use setDimensions(java.util.Collection) or withDimensions(java.util.Collection) if you want to override the existing values.

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

Constraints:
Length: 0 - 10

Parameters:
dimensions The list of dimensions associated with the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DescribeAlarmsForMetricRequest withDimensions(Dimension... dimensions) {
        if (getDimensions() == nullsetDimensions(new java.util.ArrayList<Dimension>(dimensions.length));
        for (Dimension value : dimensions) {
            getDimensions().add(value);
        }
        return this;
    }
    
    
The list of dimensions associated with the metric.

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

Constraints:
Length: 0 - 10

Parameters:
dimensions The list of dimensions associated with the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (dimensions == null) {
            this. = null;
        } else {
            dimensionsCopy.addAll(dimensions);
            this. = dimensionsCopy;
        }
        return this;
    }

    
The period in seconds over which the statistic is applied.

Constraints:
Range: 60 -

Returns:
The period in seconds over which the statistic is applied.
    public Integer getPeriod() {
        return ;
    }
    
    
The period in seconds over which the statistic is applied.

Constraints:
Range: 60 -

Parameters:
period The period in seconds over which the statistic is applied.
    public void setPeriod(Integer period) {
        this. = period;
    }
    
    
The period in seconds over which the statistic is applied.

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

Constraints:
Range: 60 -

Parameters:
period The period in seconds over which the statistic is applied.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = period;
        return this;
    }

    
The unit for the metric.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Returns:
The unit for the metric.
See also:
StandardUnit
    public String getUnit() {
        return ;
    }
    
    
The unit for the metric.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Parameters:
unit The unit for the metric.
See also:
StandardUnit
    public void setUnit(String unit) {
        this. = unit;
    }
    
    
The unit for the metric.

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

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Parameters:
unit The unit for the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
StandardUnit
        this. = unit;
        return this;
    }

    
The unit for the metric.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Parameters:
unit The unit for the metric.
See also:
StandardUnit
    public void setUnit(StandardUnit unit) {
        this. = unit.toString();
    }
    
    
The unit for the metric.

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

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Parameters:
unit The unit for the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
StandardUnit
        this. = unit.toString();
        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 (getMetricName() != nullsb.append("MetricName: " + getMetricName() + ",");
        if (getNamespace() != nullsb.append("Namespace: " + getNamespace() + ",");
        if (getStatistic() != nullsb.append("Statistic: " + getStatistic() + ",");
        if (getDimensions() != nullsb.append("Dimensions: " + getDimensions() + ",");
        if (getPeriod() != nullsb.append("Period: " + getPeriod() + ",");
        if (getUnit() != nullsb.append("Unit: " + getUnit() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getMetricName() == null) ? 0 : getMetricName().hashCode()); 
        hashCode = prime * hashCode + ((getNamespace() == null) ? 0 : getNamespace().hashCode()); 
        hashCode = prime * hashCode + ((getStatistic() == null) ? 0 : getStatistic().hashCode()); 
        hashCode = prime * hashCode + ((getDimensions() == null) ? 0 : getDimensions().hashCode()); 
        hashCode = prime * hashCode + ((getPeriod() == null) ? 0 : getPeriod().hashCode()); 
        hashCode = prime * hashCode + ((getUnit() == null) ? 0 : getUnit().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof DescribeAlarmsForMetricRequest == falsereturn false;
        
        if (other.getMetricName() == null ^ this.getMetricName() == nullreturn false;
        if (other.getMetricName() != null && other.getMetricName().equals(this.getMetricName()) == falsereturn false
        if (other.getNamespace() == null ^ this.getNamespace() == nullreturn false;
        if (other.getNamespace() != null && other.getNamespace().equals(this.getNamespace()) == falsereturn false
        if (other.getStatistic() == null ^ this.getStatistic() == nullreturn false;
        if (other.getStatistic() != null && other.getStatistic().equals(this.getStatistic()) == falsereturn false
        if (other.getDimensions() == null ^ this.getDimensions() == nullreturn false;
        if (other.getDimensions() != null && other.getDimensions().equals(this.getDimensions()) == falsereturn false
        if (other.getPeriod() == null ^ this.getPeriod() == nullreturn false;
        if (other.getPeriod() != null && other.getPeriod().equals(this.getPeriod()) == falsereturn false
        if (other.getUnit() == null ^ this.getUnit() == nullreturn false;
        if (other.getUnit() != null && other.getUnit().equals(this.getUnit()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (DescribeAlarmsForMetricRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X