
software.amazon.awssdk.services.iot.model.ListThingsRequest 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.beans.Transient;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The input for the ListThings operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ListThingsRequest extends IotRequest implements
ToCopyableBuilder {
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("nextToken").getter(getter(ListThingsRequest::nextToken)).setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("nextToken").build()).build();
private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("maxResults").getter(getter(ListThingsRequest::maxResults)).setter(setter(Builder::maxResults))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("maxResults").build()).build();
private static final SdkField ATTRIBUTE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("attributeName").getter(getter(ListThingsRequest::attributeName)).setter(setter(Builder::attributeName))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("attributeName").build()).build();
private static final SdkField ATTRIBUTE_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("attributeValue").getter(getter(ListThingsRequest::attributeValue))
.setter(setter(Builder::attributeValue))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("attributeValue").build())
.build();
private static final SdkField THING_TYPE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("thingTypeName").getter(getter(ListThingsRequest::thingTypeName)).setter(setter(Builder::thingTypeName))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("thingTypeName").build()).build();
private static final SdkField USE_PREFIX_ATTRIBUTE_VALUE_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("usePrefixAttributeValue")
.getter(getter(ListThingsRequest::usePrefixAttributeValue))
.setter(setter(Builder::usePrefixAttributeValue))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("usePrefixAttributeValue")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NEXT_TOKEN_FIELD,
MAX_RESULTS_FIELD, ATTRIBUTE_NAME_FIELD, ATTRIBUTE_VALUE_FIELD, THING_TYPE_NAME_FIELD,
USE_PREFIX_ATTRIBUTE_VALUE_FIELD));
private final String nextToken;
private final Integer maxResults;
private final String attributeName;
private final String attributeValue;
private final String thingTypeName;
private final Boolean usePrefixAttributeValue;
private ListThingsRequest(BuilderImpl builder) {
super(builder);
this.nextToken = builder.nextToken;
this.maxResults = builder.maxResults;
this.attributeName = builder.attributeName;
this.attributeValue = builder.attributeValue;
this.thingTypeName = builder.thingTypeName;
this.usePrefixAttributeValue = builder.usePrefixAttributeValue;
}
/**
*
* To retrieve the next set of results, the nextToken
value from a previous response; otherwise
* null to receive the first set of results.
*
*
* @return To retrieve the next set of results, the nextToken
value from a previous response; otherwise
* null to receive the first set of results.
*/
public final String nextToken() {
return nextToken;
}
/**
*
* The maximum number of results to return in this operation.
*
*
* @return The maximum number of results to return in this operation.
*/
public final Integer maxResults() {
return maxResults;
}
/**
*
* The attribute name used to search for things.
*
*
* @return The attribute name used to search for things.
*/
public final String attributeName() {
return attributeName;
}
/**
*
* The attribute value used to search for things.
*
*
* @return The attribute value used to search for things.
*/
public final String attributeValue() {
return attributeValue;
}
/**
*
* The name of the thing type used to search for things.
*
*
* @return The name of the thing type used to search for things.
*/
public final String thingTypeName() {
return thingTypeName;
}
/**
*
* When true
, the action returns the thing resources with attribute values that start with the
* attributeValue
provided.
*
*
* When false
, or not present, the action returns only the thing resources with attribute values that
* match the entire attributeValue
provided.
*
*
* @return When true
, the action returns the thing resources with attribute values that start with the
* attributeValue
provided.
*
* When false
, or not present, the action returns only the thing resources with attribute
* values that match the entire attributeValue
provided.
*/
public final Boolean usePrefixAttributeValue() {
return usePrefixAttributeValue;
}
@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(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
hashCode = 31 * hashCode + Objects.hashCode(attributeName());
hashCode = 31 * hashCode + Objects.hashCode(attributeValue());
hashCode = 31 * hashCode + Objects.hashCode(thingTypeName());
hashCode = 31 * hashCode + Objects.hashCode(usePrefixAttributeValue());
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 ListThingsRequest)) {
return false;
}
ListThingsRequest other = (ListThingsRequest) obj;
return Objects.equals(nextToken(), other.nextToken()) && Objects.equals(maxResults(), other.maxResults())
&& Objects.equals(attributeName(), other.attributeName())
&& Objects.equals(attributeValue(), other.attributeValue())
&& Objects.equals(thingTypeName(), other.thingTypeName())
&& Objects.equals(usePrefixAttributeValue(), other.usePrefixAttributeValue());
}
/**
* 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("ListThingsRequest").add("NextToken", nextToken()).add("MaxResults", maxResults())
.add("AttributeName", attributeName()).add("AttributeValue", attributeValue())
.add("ThingTypeName", thingTypeName()).add("UsePrefixAttributeValue", usePrefixAttributeValue()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "nextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "maxResults":
return Optional.ofNullable(clazz.cast(maxResults()));
case "attributeName":
return Optional.ofNullable(clazz.cast(attributeName()));
case "attributeValue":
return Optional.ofNullable(clazz.cast(attributeValue()));
case "thingTypeName":
return Optional.ofNullable(clazz.cast(thingTypeName()));
case "usePrefixAttributeValue":
return Optional.ofNullable(clazz.cast(usePrefixAttributeValue()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* When false
, or not present, the action returns only the thing resources with attribute
* values that match the entire attributeValue
provided.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder usePrefixAttributeValue(Boolean usePrefixAttributeValue);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends IotRequest.BuilderImpl implements Builder {
private String nextToken;
private Integer maxResults;
private String attributeName;
private String attributeValue;
private String thingTypeName;
private Boolean usePrefixAttributeValue;
private BuilderImpl() {
}
private BuilderImpl(ListThingsRequest model) {
super(model);
nextToken(model.nextToken);
maxResults(model.maxResults);
attributeName(model.attributeName);
attributeValue(model.attributeValue);
thingTypeName(model.thingTypeName);
usePrefixAttributeValue(model.usePrefixAttributeValue);
}
public final String getNextToken() {
return nextToken;
}
public final void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
@Override
@Transient
public final Builder nextToken(String nextToken) {
this.nextToken = nextToken;
return this;
}
public final Integer getMaxResults() {
return maxResults;
}
public final void setMaxResults(Integer maxResults) {
this.maxResults = maxResults;
}
@Override
@Transient
public final Builder maxResults(Integer maxResults) {
this.maxResults = maxResults;
return this;
}
public final String getAttributeName() {
return attributeName;
}
public final void setAttributeName(String attributeName) {
this.attributeName = attributeName;
}
@Override
@Transient
public final Builder attributeName(String attributeName) {
this.attributeName = attributeName;
return this;
}
public final String getAttributeValue() {
return attributeValue;
}
public final void setAttributeValue(String attributeValue) {
this.attributeValue = attributeValue;
}
@Override
@Transient
public final Builder attributeValue(String attributeValue) {
this.attributeValue = attributeValue;
return this;
}
public final String getThingTypeName() {
return thingTypeName;
}
public final void setThingTypeName(String thingTypeName) {
this.thingTypeName = thingTypeName;
}
@Override
@Transient
public final Builder thingTypeName(String thingTypeName) {
this.thingTypeName = thingTypeName;
return this;
}
public final Boolean getUsePrefixAttributeValue() {
return usePrefixAttributeValue;
}
public final void setUsePrefixAttributeValue(Boolean usePrefixAttributeValue) {
this.usePrefixAttributeValue = usePrefixAttributeValue;
}
@Override
@Transient
public final Builder usePrefixAttributeValue(Boolean usePrefixAttributeValue) {
this.usePrefixAttributeValue = usePrefixAttributeValue;
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 ListThingsRequest build() {
return new ListThingsRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}