
software.amazon.awssdk.services.location.model.GetDevicePositionHistoryRequest 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.location.model;
import java.time.Instant;
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.core.traits.TimestampFormatTrait;
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 GetDevicePositionHistoryRequest extends LocationRequest implements
ToCopyableBuilder {
private static final SdkField TRACKER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TrackerName").getter(getter(GetDevicePositionHistoryRequest::trackerName))
.setter(setter(Builder::trackerName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("TrackerName").build()).build();
private static final SdkField DEVICE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DeviceId").getter(getter(GetDevicePositionHistoryRequest::deviceId)).setter(setter(Builder::deviceId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("DeviceId").build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NextToken").getter(getter(GetDevicePositionHistoryRequest::nextToken))
.setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextToken").build()).build();
private static final SdkField START_TIME_INCLUSIVE_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("StartTimeInclusive")
.getter(getter(GetDevicePositionHistoryRequest::startTimeInclusive))
.setter(setter(Builder::startTimeInclusive))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTimeInclusive").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField END_TIME_EXCLUSIVE_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("EndTimeExclusive")
.getter(getter(GetDevicePositionHistoryRequest::endTimeExclusive))
.setter(setter(Builder::endTimeExclusive))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTimeExclusive").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxResults").getter(getter(GetDevicePositionHistoryRequest::maxResults))
.setter(setter(Builder::maxResults))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxResults").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TRACKER_NAME_FIELD,
DEVICE_ID_FIELD, NEXT_TOKEN_FIELD, START_TIME_INCLUSIVE_FIELD, END_TIME_EXCLUSIVE_FIELD, MAX_RESULTS_FIELD));
private final String trackerName;
private final String deviceId;
private final String nextToken;
private final Instant startTimeInclusive;
private final Instant endTimeExclusive;
private final Integer maxResults;
private GetDevicePositionHistoryRequest(BuilderImpl builder) {
super(builder);
this.trackerName = builder.trackerName;
this.deviceId = builder.deviceId;
this.nextToken = builder.nextToken;
this.startTimeInclusive = builder.startTimeInclusive;
this.endTimeExclusive = builder.endTimeExclusive;
this.maxResults = builder.maxResults;
}
/**
*
* The tracker resource receiving the request for the device position history.
*
*
* @return The tracker resource receiving the request for the device position history.
*/
public final String trackerName() {
return trackerName;
}
/**
*
* The device whose position history you want to retrieve.
*
*
* @return The device whose position history you want to retrieve.
*/
public final String deviceId() {
return deviceId;
}
/**
*
* The pagination token specifying which page of results to return in the response. If no token is provided, the
* default page is the first page.
*
*
* Default value: null
*
*
* @return The pagination token specifying which page of results to return in the response. If no token is provided,
* the default page is the first page.
*
* Default value: null
*/
public final String nextToken() {
return nextToken;
}
/**
*
* Specify the start time for the position history in ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
. By default, the value will be 24 hours prior to the time that the request
* is made.
*
*
* Requirement:
*
*
* -
*
* The time specified for StartTimeInclusive
must be before EndTimeExclusive
.
*
*
*
*
* @return Specify the start time for the position history in ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
. By default, the value will be 24 hours prior to the time that the
* request is made.
*
* Requirement:
*
*
* -
*
* The time specified for StartTimeInclusive
must be before EndTimeExclusive
.
*
*
*/
public final Instant startTimeInclusive() {
return startTimeInclusive;
}
/**
*
* Specify the end time for the position history in ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
. By default, the value will be the time that the request is made.
*
*
* Requirement:
*
*
* -
*
* The time specified for EndTimeExclusive
must be after the time for StartTimeInclusive
.
*
*
*
*
* @return Specify the end time for the position history in ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
. By default, the value will be the time that the request is
* made.
*
* Requirement:
*
*
* -
*
* The time specified for EndTimeExclusive
must be after the time for
* StartTimeInclusive
.
*
*
*/
public final Instant endTimeExclusive() {
return endTimeExclusive;
}
/**
*
* An optional limit for the number of device positions returned in a single call.
*
*
* Default value: 100
*
*
* @return An optional limit for the number of device positions returned in a single call.
*
* Default value: 100
*/
public final Integer maxResults() {
return maxResults;
}
@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(trackerName());
hashCode = 31 * hashCode + Objects.hashCode(deviceId());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(startTimeInclusive());
hashCode = 31 * hashCode + Objects.hashCode(endTimeExclusive());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
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 GetDevicePositionHistoryRequest)) {
return false;
}
GetDevicePositionHistoryRequest other = (GetDevicePositionHistoryRequest) obj;
return Objects.equals(trackerName(), other.trackerName()) && Objects.equals(deviceId(), other.deviceId())
&& Objects.equals(nextToken(), other.nextToken())
&& Objects.equals(startTimeInclusive(), other.startTimeInclusive())
&& Objects.equals(endTimeExclusive(), other.endTimeExclusive())
&& Objects.equals(maxResults(), other.maxResults());
}
/**
* 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("GetDevicePositionHistoryRequest").add("TrackerName", trackerName()).add("DeviceId", deviceId())
.add("NextToken", nextToken()).add("StartTimeInclusive", startTimeInclusive())
.add("EndTimeExclusive", endTimeExclusive()).add("MaxResults", maxResults()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TrackerName":
return Optional.ofNullable(clazz.cast(trackerName()));
case "DeviceId":
return Optional.ofNullable(clazz.cast(deviceId()));
case "NextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "StartTimeInclusive":
return Optional.ofNullable(clazz.cast(startTimeInclusive()));
case "EndTimeExclusive":
return Optional.ofNullable(clazz.cast(endTimeExclusive()));
case "MaxResults":
return Optional.ofNullable(clazz.cast(maxResults()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* Default value: null
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder nextToken(String nextToken);
/**
*
* Specify the start time for the position history in ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
. By default, the value will be 24 hours prior to the time that the
* request is made.
*
*
* Requirement:
*
*
* -
*
* The time specified for StartTimeInclusive
must be before EndTimeExclusive
.
*
*
*
*
* @param startTimeInclusive
* Specify the start time for the position history in ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
. By default, the value will be 24 hours prior to the time that
* the request is made.
*
* Requirement:
*
*
* -
*
* The time specified for StartTimeInclusive
must be before EndTimeExclusive
.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startTimeInclusive(Instant startTimeInclusive);
/**
*
* Specify the end time for the position history in ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
. By default, the value will be the time that the request is made.
*
*
* Requirement:
*
*
* -
*
* The time specified for EndTimeExclusive
must be after the time for
* StartTimeInclusive
.
*
*
*
*
* @param endTimeExclusive
* Specify the end time for the position history in ISO 8601 format:
* YYYY-MM-DDThh:mm:ss.sssZ
. By default, the value will be the time that the request is
* made.
*
* Requirement:
*
*
* -
*
* The time specified for EndTimeExclusive
must be after the time for
* StartTimeInclusive
.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endTimeExclusive(Instant endTimeExclusive);
/**
*
* An optional limit for the number of device positions returned in a single call.
*
*
* Default value: 100
*
*
* @param maxResults
* An optional limit for the number of device positions returned in a single call.
*
* Default value: 100
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder maxResults(Integer maxResults);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends LocationRequest.BuilderImpl implements Builder {
private String trackerName;
private String deviceId;
private String nextToken;
private Instant startTimeInclusive;
private Instant endTimeExclusive;
private Integer maxResults;
private BuilderImpl() {
}
private BuilderImpl(GetDevicePositionHistoryRequest model) {
super(model);
trackerName(model.trackerName);
deviceId(model.deviceId);
nextToken(model.nextToken);
startTimeInclusive(model.startTimeInclusive);
endTimeExclusive(model.endTimeExclusive);
maxResults(model.maxResults);
}
public final String getTrackerName() {
return trackerName;
}
public final void setTrackerName(String trackerName) {
this.trackerName = trackerName;
}
@Override
public final Builder trackerName(String trackerName) {
this.trackerName = trackerName;
return this;
}
public final String getDeviceId() {
return deviceId;
}
public final void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
@Override
public final Builder deviceId(String deviceId) {
this.deviceId = deviceId;
return this;
}
public final String getNextToken() {
return nextToken;
}
public final void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
@Override
public final Builder nextToken(String nextToken) {
this.nextToken = nextToken;
return this;
}
public final Instant getStartTimeInclusive() {
return startTimeInclusive;
}
public final void setStartTimeInclusive(Instant startTimeInclusive) {
this.startTimeInclusive = startTimeInclusive;
}
@Override
public final Builder startTimeInclusive(Instant startTimeInclusive) {
this.startTimeInclusive = startTimeInclusive;
return this;
}
public final Instant getEndTimeExclusive() {
return endTimeExclusive;
}
public final void setEndTimeExclusive(Instant endTimeExclusive) {
this.endTimeExclusive = endTimeExclusive;
}
@Override
public final Builder endTimeExclusive(Instant endTimeExclusive) {
this.endTimeExclusive = endTimeExclusive;
return this;
}
public final Integer getMaxResults() {
return maxResults;
}
public final void setMaxResults(Integer maxResults) {
this.maxResults = maxResults;
}
@Override
public final Builder maxResults(Integer maxResults) {
this.maxResults = maxResults;
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 GetDevicePositionHistoryRequest build() {
return new GetDevicePositionHistoryRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}