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

software.amazon.awssdk.services.devicefarm.model.UpdateDevicePoolRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Device Farm module holds the client classes that are used for communicating with AWS Device Farm

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright 2014-2019 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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Represents a request to the update device pool operation. *

*/ @Generated("software.amazon.awssdk:codegen") public final class UpdateDevicePoolRequest extends DeviceFarmRequest implements ToCopyableBuilder { private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(UpdateDevicePoolRequest::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) .getter(getter(UpdateDevicePoolRequest::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) .getter(getter(UpdateDevicePoolRequest::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build(); private static final SdkField> RULES_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(UpdateDevicePoolRequest::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) .getter(getter(UpdateDevicePoolRequest::maxDevices)).setter(setter(Builder::maxDevices)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maxDevices").build()).build(); private static final SdkField CLEAR_MAX_DEVICES_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .getter(getter(UpdateDevicePoolRequest::clearMaxDevices)).setter(setter(Builder::clearMaxDevices)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clearMaxDevices").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD, DESCRIPTION_FIELD, RULES_FIELD, MAX_DEVICES_FIELD, CLEAR_MAX_DEVICES_FIELD)); private final String arn; private final String name; private final String description; private final List rules; private final Integer maxDevices; private final Boolean clearMaxDevices; private UpdateDevicePoolRequest(BuilderImpl builder) { super(builder); this.arn = builder.arn; this.name = builder.name; this.description = builder.description; this.rules = builder.rules; this.maxDevices = builder.maxDevices; this.clearMaxDevices = builder.clearMaxDevices; } /** *

* The Amazon Resourc Name (ARN) of the Device Farm device pool you wish to update. *

* * @return The Amazon Resourc Name (ARN) of the Device Farm device pool you wish to update. */ public String arn() { return arn; } /** *

* A string representing the name of the device pool you wish to update. *

* * @return A string representing the name of the device pool you wish to update. */ public String name() { return name; } /** *

* A description of the device pool you wish to update. *

* * @return A description of the device pool you wish to update. */ public String description() { return description; } /** *

* Represents the rules you wish to modify for the device pool. Updating rules is optional; however, if you choose * to update rules for your request, the update will replace the existing rules. *

*

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

* * @return Represents the rules you wish to modify for the device pool. Updating rules is optional; however, if you * choose to update rules for your request, the update will replace the existing rules. */ public 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 that 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. *

*

* If you use this parameter in your request, you cannot use the clearMaxDevices parameter in the same * request. *

* * @return The number of devices that Device Farm can add to your device pool. Device Farm adds devices that are * available and that 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. *

*

* If you use this parameter in your request, you cannot use the clearMaxDevices parameter in * the same request. */ public Integer maxDevices() { return maxDevices; } /** *

* Sets whether the maxDevices parameter applies to your device pool. If you set this parameter to * true, the maxDevices parameter does not apply, and Device Farm does not limit the * number of devices that it adds to your device pool. In this case, Device Farm adds all available devices that * meet the criteria that are specified for the rules parameter. *

*

* If you use this parameter in your request, you cannot use the maxDevices parameter in the same * request. *

* * @return Sets whether the maxDevices parameter applies to your device pool. If you set this parameter * to true, the maxDevices parameter does not apply, and Device Farm does not * limit the number of devices that it adds to your device pool. In this case, Device Farm adds all * available devices that meet the criteria that are specified for the rules parameter.

*

* If you use this parameter in your request, you cannot use the maxDevices parameter in the * same request. */ public Boolean clearMaxDevices() { return clearMaxDevices; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public 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(rules()); hashCode = 31 * hashCode + Objects.hashCode(maxDevices()); hashCode = 31 * hashCode + Objects.hashCode(clearMaxDevices()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof UpdateDevicePoolRequest)) { return false; } UpdateDevicePoolRequest other = (UpdateDevicePoolRequest) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name()) && Objects.equals(description(), other.description()) && Objects.equals(rules(), other.rules()) && Objects.equals(maxDevices(), other.maxDevices()) && Objects.equals(clearMaxDevices(), other.clearMaxDevices()); } /** * 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("UpdateDevicePoolRequest").add("Arn", arn()).add("Name", name()) .add("Description", description()).add("Rules", rules()).add("MaxDevices", maxDevices()) .add("ClearMaxDevices", clearMaxDevices()).build(); } public 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 "rules": return Optional.ofNullable(clazz.cast(rules())); case "maxDevices": return Optional.ofNullable(clazz.cast(maxDevices())); case "clearMaxDevices": return Optional.ofNullable(clazz.cast(clearMaxDevices())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((UpdateDevicePoolRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends DeviceFarmRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Resourc Name (ARN) of the Device Farm device pool you wish to update. *

* * @param arn * The Amazon Resourc Name (ARN) of the Device Farm device pool you wish to update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* A string representing the name of the device pool you wish to update. *

* * @param name * A string representing the name of the device pool you wish to update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* A description of the device pool you wish to update. *

* * @param description * A description of the device pool you wish to update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* Represents the rules you wish to modify for the device pool. Updating rules is optional; however, if you * choose to update rules for your request, the update will replace the existing rules. *

* * @param rules * Represents the rules you wish to modify for the device pool. Updating rules is optional; however, if * you choose to update rules for your request, the update will replace the existing rules. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rules(Collection rules); /** *

* Represents the rules you wish to modify for the device pool. Updating rules is optional; however, if you * choose to update rules for your request, the update will replace the existing rules. *

* * @param rules * Represents the rules you wish to modify for the device pool. Updating rules is optional; however, if * you choose to update rules for your request, the update will replace the existing rules. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rules(Rule... rules); /** *

* Represents the rules you wish to modify for the device pool. Updating rules is optional; however, if you * choose to update rules for your request, the update will replace the existing rules. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create * one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #rules(List)}. * * @param rules * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #rules(List) */ 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 that 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. *

*

* If you use this parameter in your request, you cannot use the clearMaxDevices parameter in the * same request. *

* * @param maxDevices * The number of devices that Device Farm can add to your device pool. Device Farm adds devices that are * available and that 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. *

*

* If you use this parameter in your request, you cannot use the clearMaxDevices parameter * in the same request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxDevices(Integer maxDevices); /** *

* Sets whether the maxDevices parameter applies to your device pool. If you set this parameter to * true, the maxDevices parameter does not apply, and Device Farm does not limit the * number of devices that it adds to your device pool. In this case, Device Farm adds all available devices that * meet the criteria that are specified for the rules parameter. *

*

* If you use this parameter in your request, you cannot use the maxDevices parameter in the same * request. *

* * @param clearMaxDevices * Sets whether the maxDevices parameter applies to your device pool. If you set this * parameter to true, the maxDevices parameter does not apply, and Device Farm * does not limit the number of devices that it adds to your device pool. In this case, Device Farm adds * all available devices that meet the criteria that are specified for the rules * parameter.

*

* If you use this parameter in your request, you cannot use the maxDevices parameter in the * same request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clearMaxDevices(Boolean clearMaxDevices); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends DeviceFarmRequest.BuilderImpl implements Builder { private String arn; private String name; private String description; private List rules = DefaultSdkAutoConstructList.getInstance(); private Integer maxDevices; private Boolean clearMaxDevices; private BuilderImpl() { } private BuilderImpl(UpdateDevicePoolRequest model) { super(model); arn(model.arn); name(model.name); description(model.description); rules(model.rules); maxDevices(model.maxDevices); clearMaxDevices(model.clearMaxDevices); } public final String getArn() { return arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final void setArn(String arn) { this.arn = arn; } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final Collection getRules() { return rules != null ? rules.stream().map(Rule::toBuilder).collect(Collectors.toList()) : null; } @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 void setRules(Collection rules) { this.rules = RulesCopier.copyFromBuilder(rules); } public final Integer getMaxDevices() { return maxDevices; } @Override public final Builder maxDevices(Integer maxDevices) { this.maxDevices = maxDevices; return this; } public final void setMaxDevices(Integer maxDevices) { this.maxDevices = maxDevices; } public final Boolean getClearMaxDevices() { return clearMaxDevices; } @Override public final Builder clearMaxDevices(Boolean clearMaxDevices) { this.clearMaxDevices = clearMaxDevices; return this; } public final void setClearMaxDevices(Boolean clearMaxDevices) { this.clearMaxDevices = clearMaxDevices; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public UpdateDevicePoolRequest build() { return new UpdateDevicePoolRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy