software.amazon.awssdk.services.devicefarm.model.TestGridSession 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.io.Serializable;
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.Function;
import software.amazon.awssdk.annotations.Generated;
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;
/**
*
* A TestGridSession is a single instance of a browser launched from the URL provided by a call to
* CreateTestGridUrl.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TestGridSession implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(TestGridSession::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(TestGridSession::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField CREATED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("created").getter(getter(TestGridSession::created)).setter(setter(Builder::created))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("created").build()).build();
private static final SdkField ENDED_FIELD = SdkField. builder(MarshallingType.INSTANT).memberName("ended")
.getter(getter(TestGridSession::ended)).setter(setter(Builder::ended))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ended").build()).build();
private static final SdkField BILLING_MINUTES_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("billingMinutes").getter(getter(TestGridSession::billingMinutes)).setter(setter(Builder::billingMinutes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("billingMinutes").build()).build();
private static final SdkField SELENIUM_PROPERTIES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("seleniumProperties").getter(getter(TestGridSession::seleniumProperties))
.setter(setter(Builder::seleniumProperties))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("seleniumProperties").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, STATUS_FIELD,
CREATED_FIELD, ENDED_FIELD, BILLING_MINUTES_FIELD, SELENIUM_PROPERTIES_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String status;
private final Instant created;
private final Instant ended;
private final Double billingMinutes;
private final String seleniumProperties;
private TestGridSession(BuilderImpl builder) {
this.arn = builder.arn;
this.status = builder.status;
this.created = builder.created;
this.ended = builder.ended;
this.billingMinutes = builder.billingMinutes;
this.seleniumProperties = builder.seleniumProperties;
}
/**
*
* The ARN of the session.
*
*
* @return The ARN of the session.
*/
public final String arn() {
return arn;
}
/**
*
* The state of the session.
*
*
* 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 The state of the session.
* @see TestGridSessionStatus
*/
public final TestGridSessionStatus status() {
return TestGridSessionStatus.fromValue(status);
}
/**
*
* The state of the session.
*
*
* 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 The state of the session.
* @see TestGridSessionStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The time that the session was started.
*
*
* @return The time that the session was started.
*/
public final Instant created() {
return created;
}
/**
*
* The time the session ended.
*
*
* @return The time the session ended.
*/
public final Instant ended() {
return ended;
}
/**
*
* The number of billed minutes that were used for this session.
*
*
* @return The number of billed minutes that were used for this session.
*/
public final Double billingMinutes() {
return billingMinutes;
}
/**
*
* A JSON object of options and parameters passed to the Selenium WebDriver.
*
*
* @return A JSON object of options and parameters passed to the Selenium WebDriver.
*/
public final String seleniumProperties() {
return seleniumProperties;
}
@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 + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(created());
hashCode = 31 * hashCode + Objects.hashCode(ended());
hashCode = 31 * hashCode + Objects.hashCode(billingMinutes());
hashCode = 31 * hashCode + Objects.hashCode(seleniumProperties());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TestGridSession)) {
return false;
}
TestGridSession other = (TestGridSession) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(created(), other.created()) && Objects.equals(ended(), other.ended())
&& Objects.equals(billingMinutes(), other.billingMinutes())
&& Objects.equals(seleniumProperties(), other.seleniumProperties());
}
/**
* 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("TestGridSession").add("Arn", arn()).add("Status", statusAsString()).add("Created", created())
.add("Ended", ended()).add("BillingMinutes", billingMinutes()).add("SeleniumProperties", seleniumProperties())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "created":
return Optional.ofNullable(clazz.cast(created()));
case "ended":
return Optional.ofNullable(clazz.cast(ended()));
case "billingMinutes":
return Optional.ofNullable(clazz.cast(billingMinutes()));
case "seleniumProperties":
return Optional.ofNullable(clazz.cast(seleniumProperties()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function