software.amazon.awssdk.services.iot.model.UpdateFleetMetricRequest Maven / Gradle / Ivy
Show all versions of iot Show documentation
/*
* 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.iot.model;
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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateFleetMetricRequest extends IotRequest implements
ToCopyableBuilder {
private static final SdkField METRIC_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("metricName").getter(getter(UpdateFleetMetricRequest::metricName)).setter(setter(Builder::metricName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("metricName").build()).build();
private static final SdkField QUERY_STRING_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("queryString").getter(getter(UpdateFleetMetricRequest::queryString)).setter(setter(Builder::queryString))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("queryString").build()).build();
private static final SdkField AGGREGATION_TYPE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("aggregationType")
.getter(getter(UpdateFleetMetricRequest::aggregationType)).setter(setter(Builder::aggregationType))
.constructor(AggregationType::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("aggregationType").build()).build();
private static final SdkField PERIOD_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("period").getter(getter(UpdateFleetMetricRequest::period)).setter(setter(Builder::period))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("period").build()).build();
private static final SdkField AGGREGATION_FIELD_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("aggregationField").getter(getter(UpdateFleetMetricRequest::aggregationField))
.setter(setter(Builder::aggregationField))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("aggregationField").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(UpdateFleetMetricRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField QUERY_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("queryVersion").getter(getter(UpdateFleetMetricRequest::queryVersion))
.setter(setter(Builder::queryVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("queryVersion").build()).build();
private static final SdkField INDEX_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("indexName").getter(getter(UpdateFleetMetricRequest::indexName)).setter(setter(Builder::indexName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("indexName").build()).build();
private static final SdkField UNIT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("unit")
.getter(getter(UpdateFleetMetricRequest::unitAsString)).setter(setter(Builder::unit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("unit").build()).build();
private static final SdkField EXPECTED_VERSION_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("expectedVersion").getter(getter(UpdateFleetMetricRequest::expectedVersion))
.setter(setter(Builder::expectedVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("expectedVersion").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(METRIC_NAME_FIELD,
QUERY_STRING_FIELD, AGGREGATION_TYPE_FIELD, PERIOD_FIELD, AGGREGATION_FIELD_FIELD, DESCRIPTION_FIELD,
QUERY_VERSION_FIELD, INDEX_NAME_FIELD, UNIT_FIELD, EXPECTED_VERSION_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String metricName;
private final String queryString;
private final AggregationType aggregationType;
private final Integer period;
private final String aggregationField;
private final String description;
private final String queryVersion;
private final String indexName;
private final String unit;
private final Long expectedVersion;
private UpdateFleetMetricRequest(BuilderImpl builder) {
super(builder);
this.metricName = builder.metricName;
this.queryString = builder.queryString;
this.aggregationType = builder.aggregationType;
this.period = builder.period;
this.aggregationField = builder.aggregationField;
this.description = builder.description;
this.queryVersion = builder.queryVersion;
this.indexName = builder.indexName;
this.unit = builder.unit;
this.expectedVersion = builder.expectedVersion;
}
/**
*
* The name of the fleet metric to update.
*
*
* @return The name of the fleet metric to update.
*/
public final String metricName() {
return metricName;
}
/**
*
* The search query string.
*
*
* @return The search query string.
*/
public final String queryString() {
return queryString;
}
/**
*
* The type of the aggregation query.
*
*
* @return The type of the aggregation query.
*/
public final AggregationType aggregationType() {
return aggregationType;
}
/**
*
* The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60.
*
*
* @return The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple
* of 60.
*/
public final Integer period() {
return period;
}
/**
*
* The field to aggregate.
*
*
* @return The field to aggregate.
*/
public final String aggregationField() {
return aggregationField;
}
/**
*
* The description of the fleet metric.
*
*
* @return The description of the fleet metric.
*/
public final String description() {
return description;
}
/**
*
* The version of the query.
*
*
* @return The version of the query.
*/
public final String queryVersion() {
return queryVersion;
}
/**
*
* The name of the index to search.
*
*
* @return The name of the index to search.
*/
public final String indexName() {
return indexName;
}
/**
*
* Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #unit} will return
* {@link FleetMetricUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #unitAsString}.
*
*
* @return Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW
* metric.
* @see FleetMetricUnit
*/
public final FleetMetricUnit unit() {
return FleetMetricUnit.fromValue(unit);
}
/**
*
* Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #unit} will return
* {@link FleetMetricUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #unitAsString}.
*
*
* @return Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW
* metric.
* @see FleetMetricUnit
*/
public final String unitAsString() {
return unit;
}
/**
*
* The expected version of the fleet metric record in the registry.
*
*
* @return The expected version of the fleet metric record in the registry.
*/
public final Long expectedVersion() {
return expectedVersion;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(metricName());
hashCode = 31 * hashCode + Objects.hashCode(queryString());
hashCode = 31 * hashCode + Objects.hashCode(aggregationType());
hashCode = 31 * hashCode + Objects.hashCode(period());
hashCode = 31 * hashCode + Objects.hashCode(aggregationField());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(queryVersion());
hashCode = 31 * hashCode + Objects.hashCode(indexName());
hashCode = 31 * hashCode + Objects.hashCode(unitAsString());
hashCode = 31 * hashCode + Objects.hashCode(expectedVersion());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateFleetMetricRequest)) {
return false;
}
UpdateFleetMetricRequest other = (UpdateFleetMetricRequest) obj;
return Objects.equals(metricName(), other.metricName()) && Objects.equals(queryString(), other.queryString())
&& Objects.equals(aggregationType(), other.aggregationType()) && Objects.equals(period(), other.period())
&& Objects.equals(aggregationField(), other.aggregationField())
&& Objects.equals(description(), other.description()) && Objects.equals(queryVersion(), other.queryVersion())
&& Objects.equals(indexName(), other.indexName()) && Objects.equals(unitAsString(), other.unitAsString())
&& Objects.equals(expectedVersion(), other.expectedVersion());
}
/**
* 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("UpdateFleetMetricRequest").add("MetricName", metricName()).add("QueryString", queryString())
.add("AggregationType", aggregationType()).add("Period", period()).add("AggregationField", aggregationField())
.add("Description", description()).add("QueryVersion", queryVersion()).add("IndexName", indexName())
.add("Unit", unitAsString()).add("ExpectedVersion", expectedVersion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "metricName":
return Optional.ofNullable(clazz.cast(metricName()));
case "queryString":
return Optional.ofNullable(clazz.cast(queryString()));
case "aggregationType":
return Optional.ofNullable(clazz.cast(aggregationType()));
case "period":
return Optional.ofNullable(clazz.cast(period()));
case "aggregationField":
return Optional.ofNullable(clazz.cast(aggregationField()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "queryVersion":
return Optional.ofNullable(clazz.cast(queryVersion()));
case "indexName":
return Optional.ofNullable(clazz.cast(indexName()));
case "unit":
return Optional.ofNullable(clazz.cast(unitAsString()));
case "expectedVersion":
return Optional.ofNullable(clazz.cast(expectedVersion()));
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("metricName", METRIC_NAME_FIELD);
map.put("queryString", QUERY_STRING_FIELD);
map.put("aggregationType", AGGREGATION_TYPE_FIELD);
map.put("period", PERIOD_FIELD);
map.put("aggregationField", AGGREGATION_FIELD_FIELD);
map.put("description", DESCRIPTION_FIELD);
map.put("queryVersion", QUERY_VERSION_FIELD);
map.put("indexName", INDEX_NAME_FIELD);
map.put("unit", UNIT_FIELD);
map.put("expectedVersion", EXPECTED_VERSION_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function