All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.cloudwatchlogs.model.MetricTransformation Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon CloudWatch Logs module holds the client classes that are used for communicating with Amazon CloudWatch Logs Service

There is a newer version: 2.0.0-preview-11
Show newest version
/*
 * Copyright 2012-2017 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 software.amazon.awssdk.services.cloudwatchlogs.model;

import java.util.Objects;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.cloudwatchlogs.transform.MetricTransformationMarshaller;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Indicates how to transform ingested log events in to metric data in a CloudWatch metric. *

*/ @Generated("software.amazon.awssdk:codegen") public class MetricTransformation implements StructuredPojo, ToCopyableBuilder { private final String metricName; private final String metricNamespace; private final String metricValue; private final Double defaultValue; private MetricTransformation(BuilderImpl builder) { this.metricName = builder.metricName; this.metricNamespace = builder.metricNamespace; this.metricValue = builder.metricValue; this.defaultValue = builder.defaultValue; } /** *

* The name of the CloudWatch metric. *

* * @return The name of the CloudWatch metric. */ public String metricName() { return metricName; } /** *

* The namespace of the CloudWatch metric. *

* * @return The namespace of the CloudWatch metric. */ public String metricNamespace() { return metricNamespace; } /** *

* The value to publish to the CloudWatch metric when a filter pattern matches a log event. *

* * @return The value to publish to the CloudWatch metric when a filter pattern matches a log event. */ public String metricValue() { return metricValue; } /** *

* (Optional) The value to emit when a filter pattern does not match a log event. This value can be null. *

* * @return (Optional) The value to emit when a filter pattern does not match a log event. This value can be null. */ public Double defaultValue() { return defaultValue; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(metricName()); hashCode = 31 * hashCode + Objects.hashCode(metricNamespace()); hashCode = 31 * hashCode + Objects.hashCode(metricValue()); hashCode = 31 * hashCode + Objects.hashCode(defaultValue()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof MetricTransformation)) { return false; } MetricTransformation other = (MetricTransformation) obj; return Objects.equals(metricName(), other.metricName()) && Objects.equals(metricNamespace(), other.metricNamespace()) && Objects.equals(metricValue(), other.metricValue()) && Objects.equals(defaultValue(), other.defaultValue()); } @Override public String toString() { StringBuilder sb = new StringBuilder("{"); if (metricName() != null) { sb.append("MetricName: ").append(metricName()).append(","); } if (metricNamespace() != null) { sb.append("MetricNamespace: ").append(metricNamespace()).append(","); } if (metricValue() != null) { sb.append("MetricValue: ").append(metricValue()).append(","); } if (defaultValue() != null) { sb.append("DefaultValue: ").append(defaultValue()).append(","); } if (sb.length() > 1) { sb.setLength(sb.length() - 1); } sb.append("}"); return sb.toString(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "metricName": return Optional.of(clazz.cast(metricName())); case "metricNamespace": return Optional.of(clazz.cast(metricNamespace())); case "metricValue": return Optional.of(clazz.cast(metricValue())); case "defaultValue": return Optional.of(clazz.cast(defaultValue())); default: return Optional.empty(); } } @SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { MetricTransformationMarshaller.getInstance().marshall(this, protocolMarshaller); } public interface Builder extends CopyableBuilder { /** *

* The name of the CloudWatch metric. *

* * @param metricName * The name of the CloudWatch metric. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metricName(String metricName); /** *

* The namespace of the CloudWatch metric. *

* * @param metricNamespace * The namespace of the CloudWatch metric. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metricNamespace(String metricNamespace); /** *

* The value to publish to the CloudWatch metric when a filter pattern matches a log event. *

* * @param metricValue * The value to publish to the CloudWatch metric when a filter pattern matches a log event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metricValue(String metricValue); /** *

* (Optional) The value to emit when a filter pattern does not match a log event. This value can be null. *

* * @param defaultValue * (Optional) The value to emit when a filter pattern does not match a log event. This value can be null. * @return Returns a reference to this object so that method calls can be chained together. */ Builder defaultValue(Double defaultValue); } static final class BuilderImpl implements Builder { private String metricName; private String metricNamespace; private String metricValue; private Double defaultValue; private BuilderImpl() { } private BuilderImpl(MetricTransformation model) { metricName(model.metricName); metricNamespace(model.metricNamespace); metricValue(model.metricValue); defaultValue(model.defaultValue); } public final String getMetricName() { return metricName; } @Override public final Builder metricName(String metricName) { this.metricName = metricName; return this; } public final void setMetricName(String metricName) { this.metricName = metricName; } public final String getMetricNamespace() { return metricNamespace; } @Override public final Builder metricNamespace(String metricNamespace) { this.metricNamespace = metricNamespace; return this; } public final void setMetricNamespace(String metricNamespace) { this.metricNamespace = metricNamespace; } public final String getMetricValue() { return metricValue; } @Override public final Builder metricValue(String metricValue) { this.metricValue = metricValue; return this; } public final void setMetricValue(String metricValue) { this.metricValue = metricValue; } public final Double getDefaultValue() { return defaultValue; } @Override public final Builder defaultValue(Double defaultValue) { this.defaultValue = defaultValue; return this; } public final void setDefaultValue(Double defaultValue) { this.defaultValue = defaultValue; } @Override public MetricTransformation build() { return new MetricTransformation(this); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy