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

software.amazon.awssdk.services.iot.model.UpdateFleetMetricRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Iot Service module holds the client classes that are used for communicating with AWS IoT Service

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.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 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 getter(Function g) { return obj -> g.apply((UpdateFleetMetricRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends IotRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the fleet metric to update. *

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

* The search query string. *

* * @param queryString * The search query string. * @return Returns a reference to this object so that method calls can be chained together. */ Builder queryString(String queryString); /** *

* The type of the aggregation query. *

* * @param aggregationType * The type of the aggregation query. * @return Returns a reference to this object so that method calls can be chained together. */ Builder aggregationType(AggregationType aggregationType); /** *

* The type of the aggregation query. *

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

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

* The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of * 60. *

* * @param period * The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be * multiple of 60. * @return Returns a reference to this object so that method calls can be chained together. */ Builder period(Integer period); /** *

* The field to aggregate. *

* * @param aggregationField * The field to aggregate. * @return Returns a reference to this object so that method calls can be chained together. */ Builder aggregationField(String aggregationField); /** *

* The description of the fleet metric. *

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

* The version of the query. *

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

* The name of the index to search. *

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

* Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric. *

* * @param unit * Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW * metric. * @see FleetMetricUnit * @return Returns a reference to this object so that method calls can be chained together. * @see FleetMetricUnit */ Builder unit(String unit); /** *

* Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric. *

* * @param unit * Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW * metric. * @see FleetMetricUnit * @return Returns a reference to this object so that method calls can be chained together. * @see FleetMetricUnit */ Builder unit(FleetMetricUnit unit); /** *

* The expected version of the fleet metric record in the registry. *

* * @param expectedVersion * The expected version of the fleet metric record in the registry. * @return Returns a reference to this object so that method calls can be chained together. */ Builder expectedVersion(Long expectedVersion); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends IotRequest.BuilderImpl implements Builder { private String metricName; private String queryString; private AggregationType aggregationType; private Integer period; private String aggregationField; private String description; private String queryVersion; private String indexName; private String unit; private Long expectedVersion; private BuilderImpl() { } private BuilderImpl(UpdateFleetMetricRequest model) { super(model); metricName(model.metricName); queryString(model.queryString); aggregationType(model.aggregationType); period(model.period); aggregationField(model.aggregationField); description(model.description); queryVersion(model.queryVersion); indexName(model.indexName); unit(model.unit); expectedVersion(model.expectedVersion); } public final String getMetricName() { return metricName; } public final void setMetricName(String metricName) { this.metricName = metricName; } @Override public final Builder metricName(String metricName) { this.metricName = metricName; return this; } public final String getQueryString() { return queryString; } public final void setQueryString(String queryString) { this.queryString = queryString; } @Override public final Builder queryString(String queryString) { this.queryString = queryString; return this; } public final AggregationType.Builder getAggregationType() { return aggregationType != null ? aggregationType.toBuilder() : null; } public final void setAggregationType(AggregationType.BuilderImpl aggregationType) { this.aggregationType = aggregationType != null ? aggregationType.build() : null; } @Override public final Builder aggregationType(AggregationType aggregationType) { this.aggregationType = aggregationType; return this; } public final Integer getPeriod() { return period; } public final void setPeriod(Integer period) { this.period = period; } @Override public final Builder period(Integer period) { this.period = period; return this; } public final String getAggregationField() { return aggregationField; } public final void setAggregationField(String aggregationField) { this.aggregationField = aggregationField; } @Override public final Builder aggregationField(String aggregationField) { this.aggregationField = aggregationField; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final String getQueryVersion() { return queryVersion; } public final void setQueryVersion(String queryVersion) { this.queryVersion = queryVersion; } @Override public final Builder queryVersion(String queryVersion) { this.queryVersion = queryVersion; return this; } public final String getIndexName() { return indexName; } public final void setIndexName(String indexName) { this.indexName = indexName; } @Override public final Builder indexName(String indexName) { this.indexName = indexName; return this; } public final String getUnit() { return unit; } public final void setUnit(String unit) { this.unit = unit; } @Override public final Builder unit(String unit) { this.unit = unit; return this; } @Override public final Builder unit(FleetMetricUnit unit) { this.unit(unit == null ? null : unit.toString()); return this; } public final Long getExpectedVersion() { return expectedVersion; } public final void setExpectedVersion(Long expectedVersion) { this.expectedVersion = expectedVersion; } @Override public final Builder expectedVersion(Long expectedVersion) { this.expectedVersion = expectedVersion; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public UpdateFleetMetricRequest build() { return new UpdateFleetMetricRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy