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

software.amazon.awssdk.services.lookoutmetrics.model.DetectedMetricSetConfig Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Lookout Metrics module holds the client classes that are used for communicating with Lookout Metrics.

There is a newer version: 2.30.1
Show newest version
/*
 * Copyright 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.lookoutmetrics.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* An inferred dataset configuration. *

*/ @Generated("software.amazon.awssdk:codegen") public final class DetectedMetricSetConfig implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField OFFSET_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Offset").getter(getter(DetectedMetricSetConfig::offset)).setter(setter(Builder::offset)) .constructor(DetectedField::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Offset").build()).build(); private static final SdkField METRIC_SET_FREQUENCY_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("MetricSetFrequency") .getter(getter(DetectedMetricSetConfig::metricSetFrequency)).setter(setter(Builder::metricSetFrequency)) .constructor(DetectedField::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MetricSetFrequency").build()) .build(); private static final SdkField METRIC_SOURCE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("MetricSource") .getter(getter(DetectedMetricSetConfig::metricSource)).setter(setter(Builder::metricSource)) .constructor(DetectedMetricSource::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MetricSource").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OFFSET_FIELD, METRIC_SET_FREQUENCY_FIELD, METRIC_SOURCE_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final DetectedField offset; private final DetectedField metricSetFrequency; private final DetectedMetricSource metricSource; private DetectedMetricSetConfig(BuilderImpl builder) { this.offset = builder.offset; this.metricSetFrequency = builder.metricSetFrequency; this.metricSource = builder.metricSource; } /** *

* The dataset's offset. *

* * @return The dataset's offset. */ public final DetectedField offset() { return offset; } /** *

* The dataset's interval. *

* * @return The dataset's interval. */ public final DetectedField metricSetFrequency() { return metricSetFrequency; } /** *

* The dataset's data source. *

* * @return The dataset's data source. */ public final DetectedMetricSource metricSource() { return metricSource; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(offset()); hashCode = 31 * hashCode + Objects.hashCode(metricSetFrequency()); hashCode = 31 * hashCode + Objects.hashCode(metricSource()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DetectedMetricSetConfig)) { return false; } DetectedMetricSetConfig other = (DetectedMetricSetConfig) obj; return Objects.equals(offset(), other.offset()) && Objects.equals(metricSetFrequency(), other.metricSetFrequency()) && Objects.equals(metricSource(), other.metricSource()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("DetectedMetricSetConfig").add("Offset", offset()) .add("MetricSetFrequency", metricSetFrequency()).add("MetricSource", metricSource()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Offset": return Optional.ofNullable(clazz.cast(offset())); case "MetricSetFrequency": return Optional.ofNullable(clazz.cast(metricSetFrequency())); case "MetricSource": return Optional.ofNullable(clazz.cast(metricSource())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("Offset", OFFSET_FIELD); map.put("MetricSetFrequency", METRIC_SET_FREQUENCY_FIELD); map.put("MetricSource", METRIC_SOURCE_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((DetectedMetricSetConfig) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The dataset's offset. *

* * @param offset * The dataset's offset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder offset(DetectedField offset); /** *

* The dataset's offset. *

* This is a convenience method that creates an instance of the {@link DetectedField.Builder} avoiding the need * to create one manually via {@link DetectedField#builder()}. * *

* When the {@link Consumer} completes, {@link DetectedField.Builder#build()} is called immediately and its * result is passed to {@link #offset(DetectedField)}. * * @param offset * a consumer that will call methods on {@link DetectedField.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #offset(DetectedField) */ default Builder offset(Consumer offset) { return offset(DetectedField.builder().applyMutation(offset).build()); } /** *

* The dataset's interval. *

* * @param metricSetFrequency * The dataset's interval. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metricSetFrequency(DetectedField metricSetFrequency); /** *

* The dataset's interval. *

* This is a convenience method that creates an instance of the {@link DetectedField.Builder} avoiding the need * to create one manually via {@link DetectedField#builder()}. * *

* When the {@link Consumer} completes, {@link DetectedField.Builder#build()} is called immediately and its * result is passed to {@link #metricSetFrequency(DetectedField)}. * * @param metricSetFrequency * a consumer that will call methods on {@link DetectedField.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #metricSetFrequency(DetectedField) */ default Builder metricSetFrequency(Consumer metricSetFrequency) { return metricSetFrequency(DetectedField.builder().applyMutation(metricSetFrequency).build()); } /** *

* The dataset's data source. *

* * @param metricSource * The dataset's data source. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metricSource(DetectedMetricSource metricSource); /** *

* The dataset's data source. *

* This is a convenience method that creates an instance of the {@link DetectedMetricSource.Builder} avoiding * the need to create one manually via {@link DetectedMetricSource#builder()}. * *

* When the {@link Consumer} completes, {@link DetectedMetricSource.Builder#build()} is called immediately and * its result is passed to {@link #metricSource(DetectedMetricSource)}. * * @param metricSource * a consumer that will call methods on {@link DetectedMetricSource.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #metricSource(DetectedMetricSource) */ default Builder metricSource(Consumer metricSource) { return metricSource(DetectedMetricSource.builder().applyMutation(metricSource).build()); } } static final class BuilderImpl implements Builder { private DetectedField offset; private DetectedField metricSetFrequency; private DetectedMetricSource metricSource; private BuilderImpl() { } private BuilderImpl(DetectedMetricSetConfig model) { offset(model.offset); metricSetFrequency(model.metricSetFrequency); metricSource(model.metricSource); } public final DetectedField.Builder getOffset() { return offset != null ? offset.toBuilder() : null; } public final void setOffset(DetectedField.BuilderImpl offset) { this.offset = offset != null ? offset.build() : null; } @Override public final Builder offset(DetectedField offset) { this.offset = offset; return this; } public final DetectedField.Builder getMetricSetFrequency() { return metricSetFrequency != null ? metricSetFrequency.toBuilder() : null; } public final void setMetricSetFrequency(DetectedField.BuilderImpl metricSetFrequency) { this.metricSetFrequency = metricSetFrequency != null ? metricSetFrequency.build() : null; } @Override public final Builder metricSetFrequency(DetectedField metricSetFrequency) { this.metricSetFrequency = metricSetFrequency; return this; } public final DetectedMetricSource.Builder getMetricSource() { return metricSource != null ? metricSource.toBuilder() : null; } public final void setMetricSource(DetectedMetricSource.BuilderImpl metricSource) { this.metricSource = metricSource != null ? metricSource.build() : null; } @Override public final Builder metricSource(DetectedMetricSource metricSource) { this.metricSource = metricSource; return this; } @Override public DetectedMetricSetConfig build() { return new DetectedMetricSetConfig(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy