All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.devicefarm.model.DevicePool 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.devicefarm.model;

import java.io.Serializable;
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.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 a collection of device types. *

*/ @Generated("software.amazon.awssdk:codegen") public final class DevicePool implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn") .getter(getter(DevicePool::arn)).setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build(); private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name") .getter(getter(DevicePool::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("description").getter(getter(DevicePool::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build(); private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("type") .getter(getter(DevicePool::typeAsString)).setter(setter(Builder::type)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build(); private static final SdkField> RULES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("rules") .getter(getter(DevicePool::rules)) .setter(setter(Builder::rules)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("rules").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Rule::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField MAX_DEVICES_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("maxDevices").getter(getter(DevicePool::maxDevices)).setter(setter(Builder::maxDevices)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maxDevices").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD, DESCRIPTION_FIELD, TYPE_FIELD, RULES_FIELD, MAX_DEVICES_FIELD)); private static final long serialVersionUID = 1L; private final String arn; private final String name; private final String description; private final String type; private final List rules; private final Integer maxDevices; private DevicePool(BuilderImpl builder) { this.arn = builder.arn; this.name = builder.name; this.description = builder.description; this.type = builder.type; this.rules = builder.rules; this.maxDevices = builder.maxDevices; } /** *

* The device pool's ARN. *

* * @return The device pool's ARN. */ public final String arn() { return arn; } /** *

* The device pool's name. *

* * @return The device pool's name. */ public final String name() { return name; } /** *

* The device pool's description. *

* * @return The device pool's description. */ public final String description() { return description; } /** *

* The device pool's type. *

*

* Allowed values include: *

*
    *
  • *

    * CURATED: A device pool that is created and managed by AWS Device Farm. *

    *
  • *
  • *

    * PRIVATE: A device pool that is created and managed by the device pool developer. *

    *
  • *
*

* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return * {@link DevicePoolType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #typeAsString}. *

* * @return The device pool's type.

*

* Allowed values include: *

*
    *
  • *

    * CURATED: A device pool that is created and managed by AWS Device Farm. *

    *
  • *
  • *

    * PRIVATE: A device pool that is created and managed by the device pool developer. *

    *
  • * @see DevicePoolType */ public final DevicePoolType type() { return DevicePoolType.fromValue(type); } /** *

    * The device pool's type. *

    *

    * Allowed values include: *

    *
      *
    • *

      * CURATED: A device pool that is created and managed by AWS Device Farm. *

      *
    • *
    • *

      * PRIVATE: A device pool that is created and managed by the device pool developer. *

      *
    • *
    *

    * If the service returns an enum value that is not available in the current SDK version, {@link #type} will return * {@link DevicePoolType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #typeAsString}. *

    * * @return The device pool's type.

    *

    * Allowed values include: *

    *
      *
    • *

      * CURATED: A device pool that is created and managed by AWS Device Farm. *

      *
    • *
    • *

      * PRIVATE: A device pool that is created and managed by the device pool developer. *

      *
    • * @see DevicePoolType */ public final String typeAsString() { return type; } /** * For responses, this returns true if the service returned a value for the Rules property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasRules() { return rules != null && !(rules instanceof SdkAutoConstructList); } /** *

      * Information about the device pool's rules. *

      *

      * Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

      *

      * This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasRules} method. *

      * * @return Information about the device pool's rules. */ public final List rules() { return rules; } /** *

      * The number of devices that Device Farm can add to your device pool. Device Farm adds devices that are available * and meet the criteria that you assign for the rules parameter. Depending on how many devices meet * these constraints, your device pool might contain fewer devices than the value for this parameter. *

      *

      * By specifying the maximum number of devices, you can control the costs that you incur by running tests. *

      * * @return The number of devices that Device Farm can add to your device pool. Device Farm adds devices that are * available and meet the criteria that you assign for the rules parameter. Depending on how * many devices meet these constraints, your device pool might contain fewer devices than the value for this * parameter.

      *

      * By specifying the maximum number of devices, you can control the costs that you incur by running tests. */ public final Integer maxDevices() { return maxDevices; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(arn()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(typeAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasRules() ? rules() : null); hashCode = 31 * hashCode + Objects.hashCode(maxDevices()); 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 DevicePool)) { return false; } DevicePool other = (DevicePool) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name()) && Objects.equals(description(), other.description()) && Objects.equals(typeAsString(), other.typeAsString()) && hasRules() == other.hasRules() && Objects.equals(rules(), other.rules()) && Objects.equals(maxDevices(), other.maxDevices()); } /** * 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("DevicePool").add("Arn", arn()).add("Name", name()).add("Description", description()) .add("Type", typeAsString()).add("Rules", hasRules() ? rules() : null).add("MaxDevices", maxDevices()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "arn": return Optional.ofNullable(clazz.cast(arn())); case "name": return Optional.ofNullable(clazz.cast(name())); case "description": return Optional.ofNullable(clazz.cast(description())); case "type": return Optional.ofNullable(clazz.cast(typeAsString())); case "rules": return Optional.ofNullable(clazz.cast(rules())); case "maxDevices": return Optional.ofNullable(clazz.cast(maxDevices())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DevicePool) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The device pool's ARN. *

      * * @param arn * The device pool's ARN. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

      * The device pool's name. *

      * * @param name * The device pool's name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

      * The device pool's description. *

      * * @param description * The device pool's description. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

      * The device pool's type. *

      *

      * Allowed values include: *

      *
        *
      • *

        * CURATED: A device pool that is created and managed by AWS Device Farm. *

        *
      • *
      • *

        * PRIVATE: A device pool that is created and managed by the device pool developer. *

        *
      • *
      * * @param type * The device pool's type.

      *

      * Allowed values include: *

      *
        *
      • *

        * CURATED: A device pool that is created and managed by AWS Device Farm. *

        *
      • *
      • *

        * PRIVATE: A device pool that is created and managed by the device pool developer. *

        *
      • * @see DevicePoolType * @return Returns a reference to this object so that method calls can be chained together. * @see DevicePoolType */ Builder type(String type); /** *

        * The device pool's type. *

        *

        * Allowed values include: *

        *
          *
        • *

          * CURATED: A device pool that is created and managed by AWS Device Farm. *

          *
        • *
        • *

          * PRIVATE: A device pool that is created and managed by the device pool developer. *

          *
        • *
        * * @param type * The device pool's type.

        *

        * Allowed values include: *

        *
          *
        • *

          * CURATED: A device pool that is created and managed by AWS Device Farm. *

          *
        • *
        • *

          * PRIVATE: A device pool that is created and managed by the device pool developer. *

          *
        • * @see DevicePoolType * @return Returns a reference to this object so that method calls can be chained together. * @see DevicePoolType */ Builder type(DevicePoolType type); /** *

          * Information about the device pool's rules. *

          * * @param rules * Information about the device pool's rules. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rules(Collection rules); /** *

          * Information about the device pool's rules. *

          * * @param rules * Information about the device pool's rules. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rules(Rule... rules); /** *

          * Information about the device pool's rules. *

          * This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.devicefarm.model.Rule.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.devicefarm.model.Rule#builder()}. * *

          * When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.devicefarm.model.Rule.Builder#build()} is called immediately and its * result is passed to {@link #rules(List)}. * * @param rules * a consumer that will call methods on * {@link software.amazon.awssdk.services.devicefarm.model.Rule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #rules(java.util.Collection) */ Builder rules(Consumer... rules); /** *

          * The number of devices that Device Farm can add to your device pool. Device Farm adds devices that are * available and meet the criteria that you assign for the rules parameter. Depending on how many * devices meet these constraints, your device pool might contain fewer devices than the value for this * parameter. *

          *

          * By specifying the maximum number of devices, you can control the costs that you incur by running tests. *

          * * @param maxDevices * The number of devices that Device Farm can add to your device pool. Device Farm adds devices that are * available and meet the criteria that you assign for the rules parameter. Depending on how * many devices meet these constraints, your device pool might contain fewer devices than the value for * this parameter.

          *

          * By specifying the maximum number of devices, you can control the costs that you incur by running * tests. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxDevices(Integer maxDevices); } static final class BuilderImpl implements Builder { private String arn; private String name; private String description; private String type; private List rules = DefaultSdkAutoConstructList.getInstance(); private Integer maxDevices; private BuilderImpl() { } private BuilderImpl(DevicePool model) { arn(model.arn); name(model.name); description(model.description); type(model.type); rules(model.rules); maxDevices(model.maxDevices); } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final String getType() { return type; } public final void setType(String type) { this.type = type; } @Override public final Builder type(String type) { this.type = type; return this; } @Override public final Builder type(DevicePoolType type) { this.type(type == null ? null : type.toString()); return this; } public final List getRules() { List result = RulesCopier.copyToBuilder(this.rules); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setRules(Collection rules) { this.rules = RulesCopier.copyFromBuilder(rules); } @Override public final Builder rules(Collection rules) { this.rules = RulesCopier.copy(rules); return this; } @Override @SafeVarargs public final Builder rules(Rule... rules) { rules(Arrays.asList(rules)); return this; } @Override @SafeVarargs public final Builder rules(Consumer... rules) { rules(Stream.of(rules).map(c -> Rule.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final Integer getMaxDevices() { return maxDevices; } public final void setMaxDevices(Integer maxDevices) { this.maxDevices = maxDevices; } @Override public final Builder maxDevices(Integer maxDevices) { this.maxDevices = maxDevices; return this; } @Override public DevicePool build() { return new DevicePool(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy