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

Publishes metric data points to Amazon CloudWatch. Amazon Cloudwatch associates the data points with the specified metric. If the specified metric does not exist, Amazon CloudWatch creates the metric.

NOTE: If you create a metric with the PutMetricData action, allow up to fifteen minutes for the metric to appear in calls to the ListMetrics action.

The size of a PutMetricData request is limited to 8 KB for HTTP GET requests and 40 KB for HTTP POST requests.

IMPORTANT: Although the Value parameter accepts numbers of type Double, Amazon CloudWatch truncates values with very large exponents. Values with base-10 exponents greater than 126 (1 x 10^126) are truncated. Likewise, values with base-10 exponents less than -130 (1 x 10^-130) are also truncated.

 
 public class PutMetricDataRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The namespace for the metric data.

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

 
     private String namespace;

    
A list of data describing the metric.
 
The namespace for the metric data.

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

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

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

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

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

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

Parameters:
namespace The namespace for the metric data.
Returns:
A reference to this updated object so that method calls can be chained together.
    public PutMetricDataRequest withNamespace(String namespace) {
        this. = namespace;
        return this;
    }

    
A list of data describing the metric.

Returns:
A list of data describing the metric.
    public java.util.List<MetricDatumgetMetricData() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<MetricDatum>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of data describing the metric.

Parameters:
metricData A list of data describing the metric.
    public void setMetricData(java.util.Collection<MetricDatummetricData) {
        if (metricData == null) {
            this. = null;
            return;
        }
        metricDataCopy.addAll(metricData);
        this. = metricDataCopy;
    }
    
    
A list of data describing the metric.

NOTE: This method appends the values to the existing list (if any). Use setMetricData(java.util.Collection) or withMetricData(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.

Parameters:
metricData A list of data describing the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
    public PutMetricDataRequest withMetricData(MetricDatum... metricData) {
        if (getMetricData() == nullsetMetricData(new java.util.ArrayList<MetricDatum>(metricData.length));
        for (MetricDatum value : metricData) {
            getMetricData().add(value);
        }
        return this;
    }
    
    
A list of data describing the metric.

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

Parameters:
metricData A list of data describing the metric.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (metricData == null) {
            this. = null;
        } else {
            metricDataCopy.addAll(metricData);
            this. = metricDataCopy;
        }
        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 (getNamespace() != nullsb.append("Namespace: " + getNamespace() + ",");
        if (getMetricData() != nullsb.append("MetricData: " + getMetricData() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getNamespace() == null) ? 0 : getNamespace().hashCode()); 
        hashCode = prime * hashCode + ((getMetricData() == null) ? 0 : getMetricData().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof PutMetricDataRequest == falsereturn false;
        PutMetricDataRequest other = (PutMetricDataRequest)obj;
        
        if (other.getNamespace() == null ^ this.getNamespace() == nullreturn false;
        if (other.getNamespace() != null && other.getNamespace().equals(this.getNamespace()) == falsereturn false
        if (other.getMetricData() == null ^ this.getMetricData() == nullreturn false;
        if (other.getMetricData() != null && other.getMetricData().equals(this.getMetricData()) == falsereturn false
        return true;
    }
    
    @Override
    public PutMetricDataRequest clone() {
        
            return (PutMetricDataRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X