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

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

/*
 * 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.Collection;
import java.util.Collections;
import java.util.List;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 GetPercentilesRequest extends IotRequest implements
        ToCopyableBuilder {
    private static final SdkField INDEX_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("indexName").getter(getter(GetPercentilesRequest::indexName)).setter(setter(Builder::indexName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("indexName").build()).build();

    private static final SdkField QUERY_STRING_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("queryString").getter(getter(GetPercentilesRequest::queryString)).setter(setter(Builder::queryString))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("queryString").build()).build();

    private static final SdkField AGGREGATION_FIELD_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("aggregationField").getter(getter(GetPercentilesRequest::aggregationField))
            .setter(setter(Builder::aggregationField))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("aggregationField").build()).build();

    private static final SdkField QUERY_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("queryVersion").getter(getter(GetPercentilesRequest::queryVersion)).setter(setter(Builder::queryVersion))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("queryVersion").build()).build();

    private static final SdkField> PERCENTS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("percents")
            .getter(getter(GetPercentilesRequest::percents))
            .setter(setter(Builder::percents))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("percents").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.DOUBLE)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INDEX_NAME_FIELD,
            QUERY_STRING_FIELD, AGGREGATION_FIELD_FIELD, QUERY_VERSION_FIELD, PERCENTS_FIELD));

    private final String indexName;

    private final String queryString;

    private final String aggregationField;

    private final String queryVersion;

    private final List percents;

    private GetPercentilesRequest(BuilderImpl builder) {
        super(builder);
        this.indexName = builder.indexName;
        this.queryString = builder.queryString;
        this.aggregationField = builder.aggregationField;
        this.queryVersion = builder.queryVersion;
        this.percents = builder.percents;
    }

    /**
     * 

* The name of the index to search. *

* * @return The name of the index to search. */ public final String indexName() { return indexName; } /** *

* The search query string. *

* * @return The search query string. */ public final String queryString() { return queryString; } /** *

* The field to aggregate. *

* * @return The field to aggregate. */ public final String aggregationField() { return aggregationField; } /** *

* The query version. *

* * @return The query version. */ public final String queryVersion() { return queryVersion; } /** * For responses, this returns true if the service returned a value for the Percents property. This DOES NOT check * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is * useful because the SDK will never return a null collection or map, but you may need to differentiate between the * service returning nothing (or null) and the service returning an empty collection or map. For requests, this * returns true if a value for the property was specified in the request builder, and false if a value was not * specified. */ public final boolean hasPercents() { return percents != null && !(percents instanceof SdkAutoConstructList); } /** *

* The percentile groups returned. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasPercents} method. *

* * @return The percentile groups returned. */ public final List percents() { return percents; } @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(indexName()); hashCode = 31 * hashCode + Objects.hashCode(queryString()); hashCode = 31 * hashCode + Objects.hashCode(aggregationField()); hashCode = 31 * hashCode + Objects.hashCode(queryVersion()); hashCode = 31 * hashCode + Objects.hashCode(hasPercents() ? percents() : null); 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 GetPercentilesRequest)) { return false; } GetPercentilesRequest other = (GetPercentilesRequest) obj; return Objects.equals(indexName(), other.indexName()) && Objects.equals(queryString(), other.queryString()) && Objects.equals(aggregationField(), other.aggregationField()) && Objects.equals(queryVersion(), other.queryVersion()) && hasPercents() == other.hasPercents() && Objects.equals(percents(), other.percents()); } /** * 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("GetPercentilesRequest").add("IndexName", indexName()).add("QueryString", queryString()) .add("AggregationField", aggregationField()).add("QueryVersion", queryVersion()) .add("Percents", hasPercents() ? percents() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "indexName": return Optional.ofNullable(clazz.cast(indexName())); case "queryString": return Optional.ofNullable(clazz.cast(queryString())); case "aggregationField": return Optional.ofNullable(clazz.cast(aggregationField())); case "queryVersion": return Optional.ofNullable(clazz.cast(queryVersion())); case "percents": return Optional.ofNullable(clazz.cast(percents())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetPercentilesRequest) 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 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); /** *

* 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 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 query version. *

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

* The percentile groups returned. *

* * @param percents * The percentile groups returned. * @return Returns a reference to this object so that method calls can be chained together. */ Builder percents(Collection percents); /** *

* The percentile groups returned. *

* * @param percents * The percentile groups returned. * @return Returns a reference to this object so that method calls can be chained together. */ Builder percents(Double... percents); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends IotRequest.BuilderImpl implements Builder { private String indexName; private String queryString; private String aggregationField; private String queryVersion; private List percents = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(GetPercentilesRequest model) { super(model); indexName(model.indexName); queryString(model.queryString); aggregationField(model.aggregationField); queryVersion(model.queryVersion); percents(model.percents); } 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 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 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 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 Collection getPercents() { if (percents instanceof SdkAutoConstructList) { return null; } return percents; } public final void setPercents(Collection percents) { this.percents = PercentListCopier.copy(percents); } @Override public final Builder percents(Collection percents) { this.percents = PercentListCopier.copy(percents); return this; } @Override @SafeVarargs public final Builder percents(Double... percents) { percents(Arrays.asList(percents)); 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 GetPercentilesRequest build() { return new GetPercentilesRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy