software.amazon.awssdk.services.mq.model.BrokerInstanceOption Maven / Gradle / Ivy
Show all versions of mq 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.mq.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;
/**
*
* Option for host instance type.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class BrokerInstanceOption implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> AVAILABILITY_ZONES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AvailabilityZones")
.getter(getter(BrokerInstanceOption::availabilityZones))
.setter(setter(Builder::availabilityZones))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("availabilityZones").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AvailabilityZone::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ENGINE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EngineType").getter(getter(BrokerInstanceOption::engineTypeAsString))
.setter(setter(Builder::engineType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("engineType").build()).build();
private static final SdkField HOST_INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HostInstanceType").getter(getter(BrokerInstanceOption::hostInstanceType))
.setter(setter(Builder::hostInstanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("hostInstanceType").build()).build();
private static final SdkField STORAGE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StorageType").getter(getter(BrokerInstanceOption::storageTypeAsString))
.setter(setter(Builder::storageType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("storageType").build()).build();
private static final SdkField> SUPPORTED_DEPLOYMENT_MODES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SupportedDeploymentModes")
.getter(getter(BrokerInstanceOption::supportedDeploymentModesAsStrings))
.setter(setter(Builder::supportedDeploymentModesWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("supportedDeploymentModes").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> SUPPORTED_ENGINE_VERSIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SupportedEngineVersions")
.getter(getter(BrokerInstanceOption::supportedEngineVersions))
.setter(setter(Builder::supportedEngineVersions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("supportedEngineVersions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AVAILABILITY_ZONES_FIELD,
ENGINE_TYPE_FIELD, HOST_INSTANCE_TYPE_FIELD, STORAGE_TYPE_FIELD, SUPPORTED_DEPLOYMENT_MODES_FIELD,
SUPPORTED_ENGINE_VERSIONS_FIELD));
private static final long serialVersionUID = 1L;
private final List availabilityZones;
private final String engineType;
private final String hostInstanceType;
private final String storageType;
private final List supportedDeploymentModes;
private final List supportedEngineVersions;
private BrokerInstanceOption(BuilderImpl builder) {
this.availabilityZones = builder.availabilityZones;
this.engineType = builder.engineType;
this.hostInstanceType = builder.hostInstanceType;
this.storageType = builder.storageType;
this.supportedDeploymentModes = builder.supportedDeploymentModes;
this.supportedEngineVersions = builder.supportedEngineVersions;
}
/**
* For responses, this returns true if the service returned a value for the AvailabilityZones 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 hasAvailabilityZones() {
return availabilityZones != null && !(availabilityZones instanceof SdkAutoConstructList);
}
/**
*
* The list of available az.
*
*
* 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 #hasAvailabilityZones} method.
*
*
* @return The list of available az.
*/
public final List availabilityZones() {
return availabilityZones;
}
/**
*
* The broker's engine type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #engineType} will
* return {@link EngineType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #engineTypeAsString}.
*
*
* @return The broker's engine type.
* @see EngineType
*/
public final EngineType engineType() {
return EngineType.fromValue(engineType);
}
/**
*
* The broker's engine type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #engineType} will
* return {@link EngineType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #engineTypeAsString}.
*
*
* @return The broker's engine type.
* @see EngineType
*/
public final String engineTypeAsString() {
return engineType;
}
/**
*
* The broker's instance type.
*
*
* @return The broker's instance type.
*/
public final String hostInstanceType() {
return hostInstanceType;
}
/**
*
* The broker's storage type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #storageType} will
* return {@link BrokerStorageType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #storageTypeAsString}.
*
*
* @return The broker's storage type.
* @see BrokerStorageType
*/
public final BrokerStorageType storageType() {
return BrokerStorageType.fromValue(storageType);
}
/**
*
* The broker's storage type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #storageType} will
* return {@link BrokerStorageType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #storageTypeAsString}.
*
*
* @return The broker's storage type.
* @see BrokerStorageType
*/
public final String storageTypeAsString() {
return storageType;
}
/**
*
* The list of supported deployment modes.
*
*
* 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 #hasSupportedDeploymentModes} method.
*
*
* @return The list of supported deployment modes.
*/
public final List supportedDeploymentModes() {
return ___listOfDeploymentModeCopier.copyStringToEnum(supportedDeploymentModes);
}
/**
* For responses, this returns true if the service returned a value for the SupportedDeploymentModes 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 hasSupportedDeploymentModes() {
return supportedDeploymentModes != null && !(supportedDeploymentModes instanceof SdkAutoConstructList);
}
/**
*
* The list of supported deployment modes.
*
*
* 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 #hasSupportedDeploymentModes} method.
*
*
* @return The list of supported deployment modes.
*/
public final List supportedDeploymentModesAsStrings() {
return supportedDeploymentModes;
}
/**
* For responses, this returns true if the service returned a value for the SupportedEngineVersions 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 hasSupportedEngineVersions() {
return supportedEngineVersions != null && !(supportedEngineVersions instanceof SdkAutoConstructList);
}
/**
*
* The list of supported engine versions.
*
*
* 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 #hasSupportedEngineVersions} method.
*
*
* @return The list of supported engine versions.
*/
public final List supportedEngineVersions() {
return supportedEngineVersions;
}
@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(hasAvailabilityZones() ? availabilityZones() : null);
hashCode = 31 * hashCode + Objects.hashCode(engineTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hostInstanceType());
hashCode = 31 * hashCode + Objects.hashCode(storageTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasSupportedDeploymentModes() ? supportedDeploymentModesAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasSupportedEngineVersions() ? supportedEngineVersions() : null);
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 BrokerInstanceOption)) {
return false;
}
BrokerInstanceOption other = (BrokerInstanceOption) obj;
return hasAvailabilityZones() == other.hasAvailabilityZones()
&& Objects.equals(availabilityZones(), other.availabilityZones())
&& Objects.equals(engineTypeAsString(), other.engineTypeAsString())
&& Objects.equals(hostInstanceType(), other.hostInstanceType())
&& Objects.equals(storageTypeAsString(), other.storageTypeAsString())
&& hasSupportedDeploymentModes() == other.hasSupportedDeploymentModes()
&& Objects.equals(supportedDeploymentModesAsStrings(), other.supportedDeploymentModesAsStrings())
&& hasSupportedEngineVersions() == other.hasSupportedEngineVersions()
&& Objects.equals(supportedEngineVersions(), other.supportedEngineVersions());
}
/**
* 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("BrokerInstanceOption")
.add("AvailabilityZones", hasAvailabilityZones() ? availabilityZones() : null)
.add("EngineType", engineTypeAsString()).add("HostInstanceType", hostInstanceType())
.add("StorageType", storageTypeAsString())
.add("SupportedDeploymentModes", hasSupportedDeploymentModes() ? supportedDeploymentModesAsStrings() : null)
.add("SupportedEngineVersions", hasSupportedEngineVersions() ? supportedEngineVersions() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AvailabilityZones":
return Optional.ofNullable(clazz.cast(availabilityZones()));
case "EngineType":
return Optional.ofNullable(clazz.cast(engineTypeAsString()));
case "HostInstanceType":
return Optional.ofNullable(clazz.cast(hostInstanceType()));
case "StorageType":
return Optional.ofNullable(clazz.cast(storageTypeAsString()));
case "SupportedDeploymentModes":
return Optional.ofNullable(clazz.cast(supportedDeploymentModesAsStrings()));
case "SupportedEngineVersions":
return Optional.ofNullable(clazz.cast(supportedEngineVersions()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function