software.amazon.awssdk.services.devicefarm.model.ListDevicesRequest Maven / Gradle / Ivy
Show all versions of devicefarm Show documentation
/*
* Copyright 2015-2020 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.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 java.util.stream.Collectors;
import java.util.stream.Stream;
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;
/**
*
* Represents the result of a list devices request.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ListDevicesRequest extends DeviceFarmRequest implements
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ListDevicesRequest::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ListDevicesRequest::nextToken)).setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nextToken").build()).build();
private static final SdkField> FILTERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(ListDevicesRequest::filters))
.setter(setter(Builder::filters))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("filters").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DeviceFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NEXT_TOKEN_FIELD,
FILTERS_FIELD));
private final String arn;
private final String nextToken;
private final List filters;
private ListDevicesRequest(BuilderImpl builder) {
super(builder);
this.arn = builder.arn;
this.nextToken = builder.nextToken;
this.filters = builder.filters;
}
/**
*
* The Amazon Resource Name (ARN) of the project.
*
*
* @return The Amazon Resource Name (ARN) of the project.
*/
public String arn() {
return arn;
}
/**
*
* An identifier that was returned from the previous call to this operation, which can be used to return the next
* set of items in the list.
*
*
* @return An identifier that was returned from the previous call to this operation, which can be used to return the
* next set of items in the list.
*/
public String nextToken() {
return nextToken;
}
/**
* Returns true if the Filters property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasFilters() {
return filters != null && !(filters instanceof SdkAutoConstructList);
}
/**
*
* Used to select a set of devices. A filter is made up of an attribute, an operator, and one or more values.
*
*
* -
*
* Attribute: The aspect of a device such as platform or model used as the selection criteria in a device filter.
*
*
* Allowed values include:
*
*
* -
*
* ARN: The Amazon Resource Name (ARN) of the device (for example,
* arn:aws:devicefarm:us-west-2::device:12345Example
).
*
*
* -
*
* PLATFORM: The device platform. Valid values are ANDROID or IOS.
*
*
* -
*
* OS_VERSION: The operating system version (for example, 10.3.2).
*
*
* -
*
* MODEL: The device model (for example, iPad 5th Gen).
*
*
* -
*
* AVAILABILITY: The current availability of the device. Valid values are AVAILABLE, HIGHLY_AVAILABLE, BUSY, or
* TEMPORARY_NOT_AVAILABLE.
*
*
* -
*
* FORM_FACTOR: The device form factor. Valid values are PHONE or TABLET.
*
*
* -
*
* MANUFACTURER: The device manufacturer (for example, Apple).
*
*
* -
*
* REMOTE_ACCESS_ENABLED: Whether the device is enabled for remote access. Valid values are TRUE or FALSE.
*
*
* -
*
* REMOTE_DEBUG_ENABLED: Whether the device is enabled for remote debugging. Valid values are TRUE or FALSE. Because
* remote debugging is no longer
* supported, this attribute is ignored.
*
*
* -
*
* INSTANCE_ARN: The Amazon Resource Name (ARN) of the device instance.
*
*
* -
*
* INSTANCE_LABELS: The label of the device instance.
*
*
* -
*
* FLEET_TYPE: The fleet type. Valid values are PUBLIC or PRIVATE.
*
*
*
*
* -
*
* Operator: The filter operator.
*
*
* -
*
* The EQUALS operator is available for every attribute except INSTANCE_LABELS.
*
*
* -
*
* The CONTAINS operator is available for the INSTANCE_LABELS and MODEL attributes.
*
*
* -
*
* The IN and NOT_IN operators are available for the ARN, OS_VERSION, MODEL, MANUFACTURER, and INSTANCE_ARN
* attributes.
*
*
* -
*
* The LESS_THAN, GREATER_THAN, LESS_THAN_OR_EQUALS, and GREATER_THAN_OR_EQUALS operators are also available for the
* OS_VERSION attribute.
*
*
*
*
* -
*
* Values: An array of one or more filter values.
*
*
* -
*
* The IN and NOT_IN operators take a values array that has one or more elements.
*
*
* -
*
* The other operators require an array with a single element.
*
*
* -
*
* In a request, the AVAILABILITY attribute takes the following values: AVAILABLE, HIGHLY_AVAILABLE, BUSY, or
* TEMPORARY_NOT_AVAILABLE.
*
*
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasFilters()} to see if a value was sent in this field.
*
*
* @return Used to select a set of devices. A filter is made up of an attribute, an operator, and one or more
* values.
*
* -
*
* Attribute: The aspect of a device such as platform or model used as the selection criteria in a device
* filter.
*
*
* Allowed values include:
*
*
* -
*
* ARN: The Amazon Resource Name (ARN) of the device (for example,
* arn:aws:devicefarm:us-west-2::device:12345Example
).
*
*
* -
*
* PLATFORM: The device platform. Valid values are ANDROID or IOS.
*
*
* -
*
* OS_VERSION: The operating system version (for example, 10.3.2).
*
*
* -
*
* MODEL: The device model (for example, iPad 5th Gen).
*
*
* -
*
* AVAILABILITY: The current availability of the device. Valid values are AVAILABLE, HIGHLY_AVAILABLE, BUSY,
* or TEMPORARY_NOT_AVAILABLE.
*
*
* -
*
* FORM_FACTOR: The device form factor. Valid values are PHONE or TABLET.
*
*
* -
*
* MANUFACTURER: The device manufacturer (for example, Apple).
*
*
* -
*
* REMOTE_ACCESS_ENABLED: Whether the device is enabled for remote access. Valid values are TRUE or FALSE.
*
*
* -
*
* REMOTE_DEBUG_ENABLED: Whether the device is enabled for remote debugging. Valid values are TRUE or FALSE.
* Because remote debugging is no longer supported,
* this attribute is ignored.
*
*
* -
*
* INSTANCE_ARN: The Amazon Resource Name (ARN) of the device instance.
*
*
* -
*
* INSTANCE_LABELS: The label of the device instance.
*
*
* -
*
* FLEET_TYPE: The fleet type. Valid values are PUBLIC or PRIVATE.
*
*
*
*
* -
*
* Operator: The filter operator.
*
*
* -
*
* The EQUALS operator is available for every attribute except INSTANCE_LABELS.
*
*
* -
*
* The CONTAINS operator is available for the INSTANCE_LABELS and MODEL attributes.
*
*
* -
*
* The IN and NOT_IN operators are available for the ARN, OS_VERSION, MODEL, MANUFACTURER, and INSTANCE_ARN
* attributes.
*
*
* -
*
* The LESS_THAN, GREATER_THAN, LESS_THAN_OR_EQUALS, and GREATER_THAN_OR_EQUALS operators are also available
* for the OS_VERSION attribute.
*
*
*
*
* -
*
* Values: An array of one or more filter values.
*
*
* -
*
* The IN and NOT_IN operators take a values array that has one or more elements.
*
*
* -
*
* The other operators require an array with a single element.
*
*
* -
*
* In a request, the AVAILABILITY attribute takes the following values: AVAILABLE, HIGHLY_AVAILABLE, BUSY,
* or TEMPORARY_NOT_AVAILABLE.
*
*
*
*
*/
public List filters() {
return filters;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(filters());
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 ListDevicesRequest)) {
return false;
}
ListDevicesRequest other = (ListDevicesRequest) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(nextToken(), other.nextToken())
&& Objects.equals(filters(), other.filters());
}
/**
* 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("ListDevicesRequest").add("Arn", arn()).add("NextToken", nextToken()).add("Filters", filters())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "nextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "filters":
return Optional.ofNullable(clazz.cast(filters()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function