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

software.amazon.awscdk.services.cloudwatch.MetricGraphConfig Maven / Gradle / Ivy

package software.amazon.awscdk.services.cloudwatch;

/**
 * Properties used to construct the Metric identifying part of a Graph.
 */
@javax.annotation.Generated(value = "jsii-pacmak/0.19.0 (build 7c562bc)", date = "2019-10-22T08:20:38.288Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface MetricGraphConfig extends software.amazon.jsii.JsiiSerializable {

    /**
     * Name of the metric.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    java.lang.String getMetricName();

    /**
     * Namespace of the metric.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    java.lang.String getNamespace();

    /**
     * How many seconds to aggregate over.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    java.lang.Number getPeriod();

    /**
     * Color for the graph line.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    java.lang.String getColor();

    /**
     * The dimensions to apply to the alarm.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    java.util.List getDimensions();

    /**
     * Label for the metric.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    java.lang.String getLabel();

    /**
     * Aggregation function to use (can be either simple or a percentile).
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    java.lang.String getStatistic();

    /**
     * The unit of the alarm.
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    software.amazon.awscdk.services.cloudwatch.Unit getUnit();

    /**
     * @return a {@link Builder} of {@link MetricGraphConfig}
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    static Builder builder() {
        return new Builder();
    }
    /**
     * A builder for {@link MetricGraphConfig}
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    public static final class Builder {
        private java.lang.String metricName;
        private java.lang.String namespace;
        private java.lang.Number period;
        private java.lang.String color;
        private java.util.List dimensions;
        private java.lang.String label;
        private java.lang.String statistic;
        private software.amazon.awscdk.services.cloudwatch.Unit unit;

        /**
         * Sets the value of MetricName
         * @param metricName Name of the metric. This parameter is required.
         * @return {@code this}
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder metricName(java.lang.String metricName) {
            this.metricName = metricName;
            return this;
        }

        /**
         * Sets the value of Namespace
         * @param namespace Namespace of the metric. This parameter is required.
         * @return {@code this}
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder namespace(java.lang.String namespace) {
            this.namespace = namespace;
            return this;
        }

        /**
         * Sets the value of Period
         * @param period How many seconds to aggregate over. This parameter is required.
         * @return {@code this}
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder period(java.lang.Number period) {
            this.period = period;
            return this;
        }

        /**
         * Sets the value of Color
         * @param color Color for the graph line.
         * @return {@code this}
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder color(java.lang.String color) {
            this.color = color;
            return this;
        }

        /**
         * Sets the value of Dimensions
         * @param dimensions The dimensions to apply to the alarm.
         * @return {@code this}
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder dimensions(java.util.List dimensions) {
            this.dimensions = dimensions;
            return this;
        }

        /**
         * Sets the value of Label
         * @param label Label for the metric.
         * @return {@code this}
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder label(java.lang.String label) {
            this.label = label;
            return this;
        }

        /**
         * Sets the value of Statistic
         * @param statistic Aggregation function to use (can be either simple or a percentile).
         * @return {@code this}
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder statistic(java.lang.String statistic) {
            this.statistic = statistic;
            return this;
        }

        /**
         * Sets the value of Unit
         * @param unit The unit of the alarm.
         * @return {@code this}
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public Builder unit(software.amazon.awscdk.services.cloudwatch.Unit unit) {
            this.unit = unit;
            return this;
        }

        /**
         * Builds the configured instance.
         * @return a new instance of {@link MetricGraphConfig}
         * @throws NullPointerException if any required attribute was not provided
         */
        @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
        public MetricGraphConfig build() {
            return new Jsii$Proxy(metricName, namespace, period, color, dimensions, label, statistic, unit);
        }
    }

    /**
     * An implementation for {@link MetricGraphConfig}
     */
    @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
    final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements MetricGraphConfig {
        private final java.lang.String metricName;
        private final java.lang.String namespace;
        private final java.lang.Number period;
        private final java.lang.String color;
        private final java.util.List dimensions;
        private final java.lang.String label;
        private final java.lang.String statistic;
        private final software.amazon.awscdk.services.cloudwatch.Unit unit;

        /**
         * Constructor that initializes the object based on values retrieved from the JsiiObject.
         * @param objRef Reference to the JSII managed object.
         */
        protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
            super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
            this.setObjRef(objRef);
            this.metricName = this.jsiiGet("metricName", java.lang.String.class);
            this.namespace = this.jsiiGet("namespace", java.lang.String.class);
            this.period = this.jsiiGet("period", java.lang.Number.class);
            this.color = this.jsiiGet("color", java.lang.String.class);
            this.dimensions = this.jsiiGet("dimensions", java.util.List.class);
            this.label = this.jsiiGet("label", java.lang.String.class);
            this.statistic = this.jsiiGet("statistic", java.lang.String.class);
            this.unit = this.jsiiGet("unit", software.amazon.awscdk.services.cloudwatch.Unit.class);
        }

        /**
         * Constructor that initializes the object based on literal property values passed by the {@link Builder}.
         */
        private Jsii$Proxy(java.lang.String metricName, java.lang.String namespace, java.lang.Number period, java.lang.String color, java.util.List dimensions, java.lang.String label, java.lang.String statistic, software.amazon.awscdk.services.cloudwatch.Unit unit) {
            super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
            this.metricName = java.util.Objects.requireNonNull(metricName, "metricName is required");
            this.namespace = java.util.Objects.requireNonNull(namespace, "namespace is required");
            this.period = java.util.Objects.requireNonNull(period, "period is required");
            this.color = color;
            this.dimensions = dimensions;
            this.label = label;
            this.statistic = statistic;
            this.unit = unit;
        }

        @Override
        public java.lang.String getMetricName() {
            return this.metricName;
        }

        @Override
        public java.lang.String getNamespace() {
            return this.namespace;
        }

        @Override
        public java.lang.Number getPeriod() {
            return this.period;
        }

        @Override
        public java.lang.String getColor() {
            return this.color;
        }

        @Override
        public java.util.List getDimensions() {
            return this.dimensions;
        }

        @Override
        public java.lang.String getLabel() {
            return this.label;
        }

        @Override
        public java.lang.String getStatistic() {
            return this.statistic;
        }

        @Override
        public software.amazon.awscdk.services.cloudwatch.Unit getUnit() {
            return this.unit;
        }

        @Override
        public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
            com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
            com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
            obj.set("metricName", om.valueToTree(this.getMetricName()));
            obj.set("namespace", om.valueToTree(this.getNamespace()));
            obj.set("period", om.valueToTree(this.getPeriod()));
            if (this.getColor() != null) {
                obj.set("color", om.valueToTree(this.getColor()));
            }
            if (this.getDimensions() != null) {
                obj.set("dimensions", om.valueToTree(this.getDimensions()));
            }
            if (this.getLabel() != null) {
                obj.set("label", om.valueToTree(this.getLabel()));
            }
            if (this.getStatistic() != null) {
                obj.set("statistic", om.valueToTree(this.getStatistic()));
            }
            if (this.getUnit() != null) {
                obj.set("unit", om.valueToTree(this.getUnit()));
            }
            return obj;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            MetricGraphConfig.Jsii$Proxy that = (MetricGraphConfig.Jsii$Proxy) o;

            if (!metricName.equals(that.metricName)) return false;
            if (!namespace.equals(that.namespace)) return false;
            if (!period.equals(that.period)) return false;
            if (this.color != null ? !this.color.equals(that.color) : that.color != null) return false;
            if (this.dimensions != null ? !this.dimensions.equals(that.dimensions) : that.dimensions != null) return false;
            if (this.label != null ? !this.label.equals(that.label) : that.label != null) return false;
            if (this.statistic != null ? !this.statistic.equals(that.statistic) : that.statistic != null) return false;
            return this.unit != null ? this.unit.equals(that.unit) : that.unit == null;
        }

        @Override
        public int hashCode() {
            int result = this.metricName.hashCode();
            result = 31 * result + (this.namespace.hashCode());
            result = 31 * result + (this.period.hashCode());
            result = 31 * result + (this.color != null ? this.color.hashCode() : 0);
            result = 31 * result + (this.dimensions != null ? this.dimensions.hashCode() : 0);
            result = 31 * result + (this.label != null ? this.label.hashCode() : 0);
            result = 31 * result + (this.statistic != null ? this.statistic.hashCode() : 0);
            result = 31 * result + (this.unit != null ? this.unit.hashCode() : 0);
            return result;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy