software.amazon.awssdk.services.devicefarm.model.ListTestGridSessionsRequest Maven / Gradle / Ivy
Show all versions of devicefarm 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.devicefarm.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class ListTestGridSessionsRequest extends DeviceFarmRequest implements
ToCopyableBuilder {
private static final SdkField PROJECT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("projectArn").getter(getter(ListTestGridSessionsRequest::projectArn)).setter(setter(Builder::projectArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("projectArn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(ListTestGridSessionsRequest::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField CREATION_TIME_AFTER_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationTimeAfter").getter(getter(ListTestGridSessionsRequest::creationTimeAfter))
.setter(setter(Builder::creationTimeAfter))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTimeAfter").build()).build();
private static final SdkField CREATION_TIME_BEFORE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationTimeBefore").getter(getter(ListTestGridSessionsRequest::creationTimeBefore))
.setter(setter(Builder::creationTimeBefore))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTimeBefore").build())
.build();
private static final SdkField END_TIME_AFTER_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("endTimeAfter").getter(getter(ListTestGridSessionsRequest::endTimeAfter))
.setter(setter(Builder::endTimeAfter))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTimeAfter").build()).build();
private static final SdkField END_TIME_BEFORE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("endTimeBefore").getter(getter(ListTestGridSessionsRequest::endTimeBefore))
.setter(setter(Builder::endTimeBefore))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTimeBefore").build()).build();
private static final SdkField MAX_RESULT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("maxResult").getter(getter(ListTestGridSessionsRequest::maxResult)).setter(setter(Builder::maxResult))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maxResult").build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("nextToken").getter(getter(ListTestGridSessionsRequest::nextToken)).setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nextToken").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PROJECT_ARN_FIELD,
STATUS_FIELD, CREATION_TIME_AFTER_FIELD, CREATION_TIME_BEFORE_FIELD, END_TIME_AFTER_FIELD, END_TIME_BEFORE_FIELD,
MAX_RESULT_FIELD, NEXT_TOKEN_FIELD));
private final String projectArn;
private final String status;
private final Instant creationTimeAfter;
private final Instant creationTimeBefore;
private final Instant endTimeAfter;
private final Instant endTimeBefore;
private final Integer maxResult;
private final String nextToken;
private ListTestGridSessionsRequest(BuilderImpl builder) {
super(builder);
this.projectArn = builder.projectArn;
this.status = builder.status;
this.creationTimeAfter = builder.creationTimeAfter;
this.creationTimeBefore = builder.creationTimeBefore;
this.endTimeAfter = builder.endTimeAfter;
this.endTimeBefore = builder.endTimeBefore;
this.maxResult = builder.maxResult;
this.nextToken = builder.nextToken;
}
/**
*
* ARN of a TestGridProject.
*
*
* @return ARN of a TestGridProject.
*/
public String projectArn() {
return projectArn;
}
/**
*
* Return only sessions in this state.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link TestGridSessionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return Return only sessions in this state.
* @see TestGridSessionStatus
*/
public TestGridSessionStatus status() {
return TestGridSessionStatus.fromValue(status);
}
/**
*
* Return only sessions in this state.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link TestGridSessionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return Return only sessions in this state.
* @see TestGridSessionStatus
*/
public String statusAsString() {
return status;
}
/**
*
* Return only sessions created after this time.
*
*
* @return Return only sessions created after this time.
*/
public Instant creationTimeAfter() {
return creationTimeAfter;
}
/**
*
* Return only sessions created before this time.
*
*
* @return Return only sessions created before this time.
*/
public Instant creationTimeBefore() {
return creationTimeBefore;
}
/**
*
* Return only sessions that ended after this time.
*
*
* @return Return only sessions that ended after this time.
*/
public Instant endTimeAfter() {
return endTimeAfter;
}
/**
*
* Return only sessions that ended before this time.
*
*
* @return Return only sessions that ended before this time.
*/
public Instant endTimeBefore() {
return endTimeBefore;
}
/**
*
* Return only this many results at a time.
*
*
* @return Return only this many results at a time.
*/
public Integer maxResult() {
return maxResult;
}
/**
*
* Pagination token.
*
*
* @return Pagination token.
*/
public String nextToken() {
return nextToken;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(projectArn());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTimeAfter());
hashCode = 31 * hashCode + Objects.hashCode(creationTimeBefore());
hashCode = 31 * hashCode + Objects.hashCode(endTimeAfter());
hashCode = 31 * hashCode + Objects.hashCode(endTimeBefore());
hashCode = 31 * hashCode + Objects.hashCode(maxResult());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ListTestGridSessionsRequest)) {
return false;
}
ListTestGridSessionsRequest other = (ListTestGridSessionsRequest) obj;
return Objects.equals(projectArn(), other.projectArn()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(creationTimeAfter(), other.creationTimeAfter())
&& Objects.equals(creationTimeBefore(), other.creationTimeBefore())
&& Objects.equals(endTimeAfter(), other.endTimeAfter()) && Objects.equals(endTimeBefore(), other.endTimeBefore())
&& Objects.equals(maxResult(), other.maxResult()) && Objects.equals(nextToken(), other.nextToken());
}
/**
* 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 String toString() {
return ToString.builder("ListTestGridSessionsRequest").add("ProjectArn", projectArn()).add("Status", statusAsString())
.add("CreationTimeAfter", creationTimeAfter()).add("CreationTimeBefore", creationTimeBefore())
.add("EndTimeAfter", endTimeAfter()).add("EndTimeBefore", endTimeBefore()).add("MaxResult", maxResult())
.add("NextToken", nextToken()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "projectArn":
return Optional.ofNullable(clazz.cast(projectArn()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "creationTimeAfter":
return Optional.ofNullable(clazz.cast(creationTimeAfter()));
case "creationTimeBefore":
return Optional.ofNullable(clazz.cast(creationTimeBefore()));
case "endTimeAfter":
return Optional.ofNullable(clazz.cast(endTimeAfter()));
case "endTimeBefore":
return Optional.ofNullable(clazz.cast(endTimeBefore()));
case "maxResult":
return Optional.ofNullable(clazz.cast(maxResult()));
case "nextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function