software.amazon.awssdk.services.securityhub.model.AwsEc2SubnetDetails 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.securityhub.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;
/**
*
* Contains information about a subnet in Amazon EC2.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AwsEc2SubnetDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ASSIGN_IPV6_ADDRESS_ON_CREATION_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("AssignIpv6AddressOnCreation")
.getter(getter(AwsEc2SubnetDetails::assignIpv6AddressOnCreation))
.setter(setter(Builder::assignIpv6AddressOnCreation))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssignIpv6AddressOnCreation")
.build()).build();
private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AvailabilityZone").getter(getter(AwsEc2SubnetDetails::availabilityZone))
.setter(setter(Builder::availabilityZone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone").build()).build();
private static final SdkField AVAILABILITY_ZONE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AvailabilityZoneId").getter(getter(AwsEc2SubnetDetails::availabilityZoneId))
.setter(setter(Builder::availabilityZoneId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZoneId").build())
.build();
private static final SdkField AVAILABLE_IP_ADDRESS_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("AvailableIpAddressCount").getter(getter(AwsEc2SubnetDetails::availableIpAddressCount))
.setter(setter(Builder::availableIpAddressCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailableIpAddressCount").build())
.build();
private static final SdkField CIDR_BLOCK_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CidrBlock").getter(getter(AwsEc2SubnetDetails::cidrBlock)).setter(setter(Builder::cidrBlock))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CidrBlock").build()).build();
private static final SdkField DEFAULT_FOR_AZ_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DefaultForAz").getter(getter(AwsEc2SubnetDetails::defaultForAz)).setter(setter(Builder::defaultForAz))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultForAz").build()).build();
private static final SdkField MAP_PUBLIC_IP_ON_LAUNCH_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("MapPublicIpOnLaunch").getter(getter(AwsEc2SubnetDetails::mapPublicIpOnLaunch))
.setter(setter(Builder::mapPublicIpOnLaunch))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MapPublicIpOnLaunch").build())
.build();
private static final SdkField OWNER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OwnerId").getter(getter(AwsEc2SubnetDetails::ownerId)).setter(setter(Builder::ownerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OwnerId").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(AwsEc2SubnetDetails::state)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField SUBNET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SubnetArn").getter(getter(AwsEc2SubnetDetails::subnetArn)).setter(setter(Builder::subnetArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubnetArn").build()).build();
private static final SdkField SUBNET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SubnetId").getter(getter(AwsEc2SubnetDetails::subnetId)).setter(setter(Builder::subnetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubnetId").build()).build();
private static final SdkField VPC_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("VpcId")
.getter(getter(AwsEc2SubnetDetails::vpcId)).setter(setter(Builder::vpcId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcId").build()).build();
private static final SdkField> IPV6_CIDR_BLOCK_ASSOCIATION_SET_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Ipv6CidrBlockAssociationSet")
.getter(getter(AwsEc2SubnetDetails::ipv6CidrBlockAssociationSet))
.setter(setter(Builder::ipv6CidrBlockAssociationSet))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Ipv6CidrBlockAssociationSet")
.build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Ipv6CidrBlockAssociation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
ASSIGN_IPV6_ADDRESS_ON_CREATION_FIELD, AVAILABILITY_ZONE_FIELD, AVAILABILITY_ZONE_ID_FIELD,
AVAILABLE_IP_ADDRESS_COUNT_FIELD, CIDR_BLOCK_FIELD, DEFAULT_FOR_AZ_FIELD, MAP_PUBLIC_IP_ON_LAUNCH_FIELD,
OWNER_ID_FIELD, STATE_FIELD, SUBNET_ARN_FIELD, SUBNET_ID_FIELD, VPC_ID_FIELD, IPV6_CIDR_BLOCK_ASSOCIATION_SET_FIELD));
private static final long serialVersionUID = 1L;
private final Boolean assignIpv6AddressOnCreation;
private final String availabilityZone;
private final String availabilityZoneId;
private final Integer availableIpAddressCount;
private final String cidrBlock;
private final Boolean defaultForAz;
private final Boolean mapPublicIpOnLaunch;
private final String ownerId;
private final String state;
private final String subnetArn;
private final String subnetId;
private final String vpcId;
private final List ipv6CidrBlockAssociationSet;
private AwsEc2SubnetDetails(BuilderImpl builder) {
this.assignIpv6AddressOnCreation = builder.assignIpv6AddressOnCreation;
this.availabilityZone = builder.availabilityZone;
this.availabilityZoneId = builder.availabilityZoneId;
this.availableIpAddressCount = builder.availableIpAddressCount;
this.cidrBlock = builder.cidrBlock;
this.defaultForAz = builder.defaultForAz;
this.mapPublicIpOnLaunch = builder.mapPublicIpOnLaunch;
this.ownerId = builder.ownerId;
this.state = builder.state;
this.subnetArn = builder.subnetArn;
this.subnetId = builder.subnetId;
this.vpcId = builder.vpcId;
this.ipv6CidrBlockAssociationSet = builder.ipv6CidrBlockAssociationSet;
}
/**
*
* Whether to assign an IPV6 address to a network interface that is created in this subnet.
*
*
* @return Whether to assign an IPV6 address to a network interface that is created in this subnet.
*/
public final Boolean assignIpv6AddressOnCreation() {
return assignIpv6AddressOnCreation;
}
/**
*
* The Availability Zone for the subnet.
*
*
* @return The Availability Zone for the subnet.
*/
public final String availabilityZone() {
return availabilityZone;
}
/**
*
* The identifier of the Availability Zone for the subnet.
*
*
* @return The identifier of the Availability Zone for the subnet.
*/
public final String availabilityZoneId() {
return availabilityZoneId;
}
/**
*
* The number of available IPV4 addresses in the subnet. Does not include addresses for stopped instances.
*
*
* @return The number of available IPV4 addresses in the subnet. Does not include addresses for stopped instances.
*/
public final Integer availableIpAddressCount() {
return availableIpAddressCount;
}
/**
*
* The IPV4 CIDR block that is assigned to the subnet.
*
*
* @return The IPV4 CIDR block that is assigned to the subnet.
*/
public final String cidrBlock() {
return cidrBlock;
}
/**
*
* Whether this subnet is the default subnet for the Availability Zone.
*
*
* @return Whether this subnet is the default subnet for the Availability Zone.
*/
public final Boolean defaultForAz() {
return defaultForAz;
}
/**
*
* Whether instances in this subnet receive a public IP address.
*
*
* @return Whether instances in this subnet receive a public IP address.
*/
public final Boolean mapPublicIpOnLaunch() {
return mapPublicIpOnLaunch;
}
/**
*
* The identifier of the Amazon Web Services account that owns the subnet.
*
*
* @return The identifier of the Amazon Web Services account that owns the subnet.
*/
public final String ownerId() {
return ownerId;
}
/**
*
* The current state of the subnet. Valid values are available or pending.
*
*
* @return The current state of the subnet. Valid values are available or pending.
*/
public final String state() {
return state;
}
/**
*
* The ARN of the subnet.
*
*
* @return The ARN of the subnet.
*/
public final String subnetArn() {
return subnetArn;
}
/**
*
* The identifier of the subnet.
*
*
* @return The identifier of the subnet.
*/
public final String subnetId() {
return subnetId;
}
/**
*
* The identifier of the VPC that contains the subnet.
*
*
* @return The identifier of the VPC that contains the subnet.
*/
public final String vpcId() {
return vpcId;
}
/**
* For responses, this returns true if the service returned a value for the Ipv6CidrBlockAssociationSet 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 hasIpv6CidrBlockAssociationSet() {
return ipv6CidrBlockAssociationSet != null && !(ipv6CidrBlockAssociationSet instanceof SdkAutoConstructList);
}
/**
*
* The IPV6 CIDR blocks that are associated with the subnet.
*
*
* 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 #hasIpv6CidrBlockAssociationSet} method.
*
*
* @return The IPV6 CIDR blocks that are associated with the subnet.
*/
public final List ipv6CidrBlockAssociationSet() {
return ipv6CidrBlockAssociationSet;
}
@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(assignIpv6AddressOnCreation());
hashCode = 31 * hashCode + Objects.hashCode(availabilityZone());
hashCode = 31 * hashCode + Objects.hashCode(availabilityZoneId());
hashCode = 31 * hashCode + Objects.hashCode(availableIpAddressCount());
hashCode = 31 * hashCode + Objects.hashCode(cidrBlock());
hashCode = 31 * hashCode + Objects.hashCode(defaultForAz());
hashCode = 31 * hashCode + Objects.hashCode(mapPublicIpOnLaunch());
hashCode = 31 * hashCode + Objects.hashCode(ownerId());
hashCode = 31 * hashCode + Objects.hashCode(state());
hashCode = 31 * hashCode + Objects.hashCode(subnetArn());
hashCode = 31 * hashCode + Objects.hashCode(subnetId());
hashCode = 31 * hashCode + Objects.hashCode(vpcId());
hashCode = 31 * hashCode + Objects.hashCode(hasIpv6CidrBlockAssociationSet() ? ipv6CidrBlockAssociationSet() : 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 AwsEc2SubnetDetails)) {
return false;
}
AwsEc2SubnetDetails other = (AwsEc2SubnetDetails) obj;
return Objects.equals(assignIpv6AddressOnCreation(), other.assignIpv6AddressOnCreation())
&& Objects.equals(availabilityZone(), other.availabilityZone())
&& Objects.equals(availabilityZoneId(), other.availabilityZoneId())
&& Objects.equals(availableIpAddressCount(), other.availableIpAddressCount())
&& Objects.equals(cidrBlock(), other.cidrBlock()) && Objects.equals(defaultForAz(), other.defaultForAz())
&& Objects.equals(mapPublicIpOnLaunch(), other.mapPublicIpOnLaunch())
&& Objects.equals(ownerId(), other.ownerId()) && Objects.equals(state(), other.state())
&& Objects.equals(subnetArn(), other.subnetArn()) && Objects.equals(subnetId(), other.subnetId())
&& Objects.equals(vpcId(), other.vpcId())
&& hasIpv6CidrBlockAssociationSet() == other.hasIpv6CidrBlockAssociationSet()
&& Objects.equals(ipv6CidrBlockAssociationSet(), other.ipv6CidrBlockAssociationSet());
}
/**
* 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("AwsEc2SubnetDetails").add("AssignIpv6AddressOnCreation", assignIpv6AddressOnCreation())
.add("AvailabilityZone", availabilityZone()).add("AvailabilityZoneId", availabilityZoneId())
.add("AvailableIpAddressCount", availableIpAddressCount()).add("CidrBlock", cidrBlock())
.add("DefaultForAz", defaultForAz()).add("MapPublicIpOnLaunch", mapPublicIpOnLaunch()).add("OwnerId", ownerId())
.add("State", state()).add("SubnetArn", subnetArn()).add("SubnetId", subnetId()).add("VpcId", vpcId())
.add("Ipv6CidrBlockAssociationSet", hasIpv6CidrBlockAssociationSet() ? ipv6CidrBlockAssociationSet() : null)
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AssignIpv6AddressOnCreation":
return Optional.ofNullable(clazz.cast(assignIpv6AddressOnCreation()));
case "AvailabilityZone":
return Optional.ofNullable(clazz.cast(availabilityZone()));
case "AvailabilityZoneId":
return Optional.ofNullable(clazz.cast(availabilityZoneId()));
case "AvailableIpAddressCount":
return Optional.ofNullable(clazz.cast(availableIpAddressCount()));
case "CidrBlock":
return Optional.ofNullable(clazz.cast(cidrBlock()));
case "DefaultForAz":
return Optional.ofNullable(clazz.cast(defaultForAz()));
case "MapPublicIpOnLaunch":
return Optional.ofNullable(clazz.cast(mapPublicIpOnLaunch()));
case "OwnerId":
return Optional.ofNullable(clazz.cast(ownerId()));
case "State":
return Optional.ofNullable(clazz.cast(state()));
case "SubnetArn":
return Optional.ofNullable(clazz.cast(subnetArn()));
case "SubnetId":
return Optional.ofNullable(clazz.cast(subnetId()));
case "VpcId":
return Optional.ofNullable(clazz.cast(vpcId()));
case "Ipv6CidrBlockAssociationSet":
return Optional.ofNullable(clazz.cast(ipv6CidrBlockAssociationSet()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function