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

software.amazon.awssdk.services.iotdeviceadvisor.model.SuiteDefinitionConfiguration Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.15
Show newest version
/*
 * 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.iotdeviceadvisor.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;

/**
 * 

* Gets the suite definition configuration. *

*/ @Generated("software.amazon.awssdk:codegen") public final class SuiteDefinitionConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField SUITE_DEFINITION_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("suiteDefinitionName").getter(getter(SuiteDefinitionConfiguration::suiteDefinitionName)) .setter(setter(Builder::suiteDefinitionName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("suiteDefinitionName").build()) .build(); private static final SdkField> DEVICES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("devices") .getter(getter(SuiteDefinitionConfiguration::devices)) .setter(setter(Builder::devices)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("devices").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(DeviceUnderTest::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField INTENDED_FOR_QUALIFICATION_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("intendedForQualification").getter(getter(SuiteDefinitionConfiguration::intendedForQualification)) .setter(setter(Builder::intendedForQualification)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("intendedForQualification").build()) .build(); private static final SdkField IS_LONG_DURATION_TEST_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isLongDurationTest").getter(getter(SuiteDefinitionConfiguration::isLongDurationTest)) .setter(setter(Builder::isLongDurationTest)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isLongDurationTest").build()) .build(); private static final SdkField ROOT_GROUP_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("rootGroup").getter(getter(SuiteDefinitionConfiguration::rootGroup)).setter(setter(Builder::rootGroup)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("rootGroup").build()).build(); private static final SdkField DEVICE_PERMISSION_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("devicePermissionRoleArn").getter(getter(SuiteDefinitionConfiguration::devicePermissionRoleArn)) .setter(setter(Builder::devicePermissionRoleArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("devicePermissionRoleArn").build()) .build(); private static final SdkField PROTOCOL_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("protocol").getter(getter(SuiteDefinitionConfiguration::protocolAsString)) .setter(setter(Builder::protocol)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("protocol").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SUITE_DEFINITION_NAME_FIELD, DEVICES_FIELD, INTENDED_FOR_QUALIFICATION_FIELD, IS_LONG_DURATION_TEST_FIELD, ROOT_GROUP_FIELD, DEVICE_PERMISSION_ROLE_ARN_FIELD, PROTOCOL_FIELD)); private static final long serialVersionUID = 1L; private final String suiteDefinitionName; private final List devices; private final Boolean intendedForQualification; private final Boolean isLongDurationTest; private final String rootGroup; private final String devicePermissionRoleArn; private final String protocol; private SuiteDefinitionConfiguration(BuilderImpl builder) { this.suiteDefinitionName = builder.suiteDefinitionName; this.devices = builder.devices; this.intendedForQualification = builder.intendedForQualification; this.isLongDurationTest = builder.isLongDurationTest; this.rootGroup = builder.rootGroup; this.devicePermissionRoleArn = builder.devicePermissionRoleArn; this.protocol = builder.protocol; } /** *

* Gets the suite definition name. This is a required parameter. *

* * @return Gets the suite definition name. This is a required parameter. */ public final String suiteDefinitionName() { return suiteDefinitionName; } /** * For responses, this returns true if the service returned a value for the Devices 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 hasDevices() { return devices != null && !(devices instanceof SdkAutoConstructList); } /** *

* Gets the devices configured. *

*

* 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 #hasDevices} method. *

* * @return Gets the devices configured. */ public final List devices() { return devices; } /** *

* Gets the tests intended for qualification in a suite. *

* * @return Gets the tests intended for qualification in a suite. */ public final Boolean intendedForQualification() { return intendedForQualification; } /** *

* Verifies if the test suite is a long duration test. *

* * @return Verifies if the test suite is a long duration test. */ public final Boolean isLongDurationTest() { return isLongDurationTest; } /** *

* Gets the test suite root group. This is a required parameter. For updating or creating the latest qualification * suite, if intendedForQualification is set to true, rootGroup can be an empty string. If * intendedForQualification is false, rootGroup cannot be an empty string. If * rootGroup is empty, and intendedForQualification is set to true, all the qualification * tests are included, and the configuration is default. *

*

* For a qualification suite, the minimum length is 0, and the maximum is 2048. For a non-qualification suite, the * minimum length is 1, and the maximum is 2048. *

* * @return Gets the test suite root group. This is a required parameter. For updating or creating the latest * qualification suite, if intendedForQualification is set to true, rootGroup can * be an empty string. If intendedForQualification is false, rootGroup cannot be * an empty string. If rootGroup is empty, and intendedForQualification is set to * true, all the qualification tests are included, and the configuration is default.

*

* For a qualification suite, the minimum length is 0, and the maximum is 2048. For a non-qualification * suite, the minimum length is 1, and the maximum is 2048. */ public final String rootGroup() { return rootGroup; } /** *

* Gets the device permission ARN. This is a required parameter. *

* * @return Gets the device permission ARN. This is a required parameter. */ public final String devicePermissionRoleArn() { return devicePermissionRoleArn; } /** *

* Sets the MQTT protocol that is configured in the suite definition. *

*

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

* * @return Sets the MQTT protocol that is configured in the suite definition. * @see Protocol */ public final Protocol protocol() { return Protocol.fromValue(protocol); } /** *

* Sets the MQTT protocol that is configured in the suite definition. *

*

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

* * @return Sets the MQTT protocol that is configured in the suite definition. * @see Protocol */ public final String protocolAsString() { return protocol; } @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(suiteDefinitionName()); hashCode = 31 * hashCode + Objects.hashCode(hasDevices() ? devices() : null); hashCode = 31 * hashCode + Objects.hashCode(intendedForQualification()); hashCode = 31 * hashCode + Objects.hashCode(isLongDurationTest()); hashCode = 31 * hashCode + Objects.hashCode(rootGroup()); hashCode = 31 * hashCode + Objects.hashCode(devicePermissionRoleArn()); hashCode = 31 * hashCode + Objects.hashCode(protocolAsString()); 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 SuiteDefinitionConfiguration)) { return false; } SuiteDefinitionConfiguration other = (SuiteDefinitionConfiguration) obj; return Objects.equals(suiteDefinitionName(), other.suiteDefinitionName()) && hasDevices() == other.hasDevices() && Objects.equals(devices(), other.devices()) && Objects.equals(intendedForQualification(), other.intendedForQualification()) && Objects.equals(isLongDurationTest(), other.isLongDurationTest()) && Objects.equals(rootGroup(), other.rootGroup()) && Objects.equals(devicePermissionRoleArn(), other.devicePermissionRoleArn()) && Objects.equals(protocolAsString(), other.protocolAsString()); } /** * 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("SuiteDefinitionConfiguration").add("SuiteDefinitionName", suiteDefinitionName()) .add("Devices", hasDevices() ? devices() : null).add("IntendedForQualification", intendedForQualification()) .add("IsLongDurationTest", isLongDurationTest()).add("RootGroup", rootGroup()) .add("DevicePermissionRoleArn", devicePermissionRoleArn()).add("Protocol", protocolAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "suiteDefinitionName": return Optional.ofNullable(clazz.cast(suiteDefinitionName())); case "devices": return Optional.ofNullable(clazz.cast(devices())); case "intendedForQualification": return Optional.ofNullable(clazz.cast(intendedForQualification())); case "isLongDurationTest": return Optional.ofNullable(clazz.cast(isLongDurationTest())); case "rootGroup": return Optional.ofNullable(clazz.cast(rootGroup())); case "devicePermissionRoleArn": return Optional.ofNullable(clazz.cast(devicePermissionRoleArn())); case "protocol": return Optional.ofNullable(clazz.cast(protocolAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((SuiteDefinitionConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Gets the suite definition name. This is a required parameter. *

* * @param suiteDefinitionName * Gets the suite definition name. This is a required parameter. * @return Returns a reference to this object so that method calls can be chained together. */ Builder suiteDefinitionName(String suiteDefinitionName); /** *

* Gets the devices configured. *

* * @param devices * Gets the devices configured. * @return Returns a reference to this object so that method calls can be chained together. */ Builder devices(Collection devices); /** *

* Gets the devices configured. *

* * @param devices * Gets the devices configured. * @return Returns a reference to this object so that method calls can be chained together. */ Builder devices(DeviceUnderTest... devices); /** *

* Gets the devices configured. *

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

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

* Gets the tests intended for qualification in a suite. *

* * @param intendedForQualification * Gets the tests intended for qualification in a suite. * @return Returns a reference to this object so that method calls can be chained together. */ Builder intendedForQualification(Boolean intendedForQualification); /** *

* Verifies if the test suite is a long duration test. *

* * @param isLongDurationTest * Verifies if the test suite is a long duration test. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isLongDurationTest(Boolean isLongDurationTest); /** *

* Gets the test suite root group. This is a required parameter. For updating or creating the latest * qualification suite, if intendedForQualification is set to true, rootGroup can be * an empty string. If intendedForQualification is false, rootGroup cannot be an empty * string. If rootGroup is empty, and intendedForQualification is set to true, all the * qualification tests are included, and the configuration is default. *

*

* For a qualification suite, the minimum length is 0, and the maximum is 2048. For a non-qualification suite, * the minimum length is 1, and the maximum is 2048. *

* * @param rootGroup * Gets the test suite root group. This is a required parameter. For updating or creating the latest * qualification suite, if intendedForQualification is set to true, rootGroup * can be an empty string. If intendedForQualification is false, rootGroup * cannot be an empty string. If rootGroup is empty, and * intendedForQualification is set to true, all the qualification tests are included, and * the configuration is default.

*

* For a qualification suite, the minimum length is 0, and the maximum is 2048. For a non-qualification * suite, the minimum length is 1, and the maximum is 2048. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rootGroup(String rootGroup); /** *

* Gets the device permission ARN. This is a required parameter. *

* * @param devicePermissionRoleArn * Gets the device permission ARN. This is a required parameter. * @return Returns a reference to this object so that method calls can be chained together. */ Builder devicePermissionRoleArn(String devicePermissionRoleArn); /** *

* Sets the MQTT protocol that is configured in the suite definition. *

* * @param protocol * Sets the MQTT protocol that is configured in the suite definition. * @see Protocol * @return Returns a reference to this object so that method calls can be chained together. * @see Protocol */ Builder protocol(String protocol); /** *

* Sets the MQTT protocol that is configured in the suite definition. *

* * @param protocol * Sets the MQTT protocol that is configured in the suite definition. * @see Protocol * @return Returns a reference to this object so that method calls can be chained together. * @see Protocol */ Builder protocol(Protocol protocol); } static final class BuilderImpl implements Builder { private String suiteDefinitionName; private List devices = DefaultSdkAutoConstructList.getInstance(); private Boolean intendedForQualification; private Boolean isLongDurationTest; private String rootGroup; private String devicePermissionRoleArn; private String protocol; private BuilderImpl() { } private BuilderImpl(SuiteDefinitionConfiguration model) { suiteDefinitionName(model.suiteDefinitionName); devices(model.devices); intendedForQualification(model.intendedForQualification); isLongDurationTest(model.isLongDurationTest); rootGroup(model.rootGroup); devicePermissionRoleArn(model.devicePermissionRoleArn); protocol(model.protocol); } public final String getSuiteDefinitionName() { return suiteDefinitionName; } public final void setSuiteDefinitionName(String suiteDefinitionName) { this.suiteDefinitionName = suiteDefinitionName; } @Override public final Builder suiteDefinitionName(String suiteDefinitionName) { this.suiteDefinitionName = suiteDefinitionName; return this; } public final List getDevices() { List result = DeviceUnderTestListCopier.copyToBuilder(this.devices); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setDevices(Collection devices) { this.devices = DeviceUnderTestListCopier.copyFromBuilder(devices); } @Override public final Builder devices(Collection devices) { this.devices = DeviceUnderTestListCopier.copy(devices); return this; } @Override @SafeVarargs public final Builder devices(DeviceUnderTest... devices) { devices(Arrays.asList(devices)); return this; } @Override @SafeVarargs public final Builder devices(Consumer... devices) { devices(Stream.of(devices).map(c -> DeviceUnderTest.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final Boolean getIntendedForQualification() { return intendedForQualification; } public final void setIntendedForQualification(Boolean intendedForQualification) { this.intendedForQualification = intendedForQualification; } @Override public final Builder intendedForQualification(Boolean intendedForQualification) { this.intendedForQualification = intendedForQualification; return this; } public final Boolean getIsLongDurationTest() { return isLongDurationTest; } public final void setIsLongDurationTest(Boolean isLongDurationTest) { this.isLongDurationTest = isLongDurationTest; } @Override public final Builder isLongDurationTest(Boolean isLongDurationTest) { this.isLongDurationTest = isLongDurationTest; return this; } public final String getRootGroup() { return rootGroup; } public final void setRootGroup(String rootGroup) { this.rootGroup = rootGroup; } @Override public final Builder rootGroup(String rootGroup) { this.rootGroup = rootGroup; return this; } public final String getDevicePermissionRoleArn() { return devicePermissionRoleArn; } public final void setDevicePermissionRoleArn(String devicePermissionRoleArn) { this.devicePermissionRoleArn = devicePermissionRoleArn; } @Override public final Builder devicePermissionRoleArn(String devicePermissionRoleArn) { this.devicePermissionRoleArn = devicePermissionRoleArn; return this; } public final String getProtocol() { return protocol; } public final void setProtocol(String protocol) { this.protocol = protocol; } @Override public final Builder protocol(String protocol) { this.protocol = protocol; return this; } @Override public final Builder protocol(Protocol protocol) { this.protocol(protocol == null ? null : protocol.toString()); return this; } @Override public SuiteDefinitionConfiguration build() { return new SuiteDefinitionConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy