software.amazon.awssdk.services.ec2.model.AllocateAddressResponse Maven / Gradle / Ivy
Show all versions of ec2 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.ec2.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class AllocateAddressResponse extends Ec2Response implements
ToCopyableBuilder {
private static final SdkField ALLOCATION_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("AllocationId")
.getter(getter(AllocateAddressResponse::allocationId))
.setter(setter(Builder::allocationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AllocationId")
.unmarshallLocationName("allocationId").build()).build();
private static final SdkField PUBLIC_IPV4_POOL_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("PublicIpv4Pool")
.getter(getter(AllocateAddressResponse::publicIpv4Pool))
.setter(setter(Builder::publicIpv4Pool))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PublicIpv4Pool")
.unmarshallLocationName("publicIpv4Pool").build()).build();
private static final SdkField NETWORK_BORDER_GROUP_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("NetworkBorderGroup")
.getter(getter(AllocateAddressResponse::networkBorderGroup))
.setter(setter(Builder::networkBorderGroup))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkBorderGroup")
.unmarshallLocationName("networkBorderGroup").build()).build();
private static final SdkField DOMAIN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Domain")
.getter(getter(AllocateAddressResponse::domainAsString))
.setter(setter(Builder::domain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Domain")
.unmarshallLocationName("domain").build()).build();
private static final SdkField CUSTOMER_OWNED_IP_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("CustomerOwnedIp")
.getter(getter(AllocateAddressResponse::customerOwnedIp))
.setter(setter(Builder::customerOwnedIp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomerOwnedIp")
.unmarshallLocationName("customerOwnedIp").build()).build();
private static final SdkField CUSTOMER_OWNED_IPV4_POOL_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("CustomerOwnedIpv4Pool")
.getter(getter(AllocateAddressResponse::customerOwnedIpv4Pool))
.setter(setter(Builder::customerOwnedIpv4Pool))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomerOwnedIpv4Pool")
.unmarshallLocationName("customerOwnedIpv4Pool").build()).build();
private static final SdkField CARRIER_IP_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("CarrierIp")
.getter(getter(AllocateAddressResponse::carrierIp))
.setter(setter(Builder::carrierIp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CarrierIp")
.unmarshallLocationName("carrierIp").build()).build();
private static final SdkField PUBLIC_IP_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("PublicIp")
.getter(getter(AllocateAddressResponse::publicIp))
.setter(setter(Builder::publicIp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PublicIp")
.unmarshallLocationName("publicIp").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ALLOCATION_ID_FIELD,
PUBLIC_IPV4_POOL_FIELD, NETWORK_BORDER_GROUP_FIELD, DOMAIN_FIELD, CUSTOMER_OWNED_IP_FIELD,
CUSTOMER_OWNED_IPV4_POOL_FIELD, CARRIER_IP_FIELD, PUBLIC_IP_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("AllocationId", ALLOCATION_ID_FIELD);
put("PublicIpv4Pool", PUBLIC_IPV4_POOL_FIELD);
put("NetworkBorderGroup", NETWORK_BORDER_GROUP_FIELD);
put("Domain", DOMAIN_FIELD);
put("CustomerOwnedIp", CUSTOMER_OWNED_IP_FIELD);
put("CustomerOwnedIpv4Pool", CUSTOMER_OWNED_IPV4_POOL_FIELD);
put("CarrierIp", CARRIER_IP_FIELD);
put("PublicIp", PUBLIC_IP_FIELD);
}
});
private final String allocationId;
private final String publicIpv4Pool;
private final String networkBorderGroup;
private final String domain;
private final String customerOwnedIp;
private final String customerOwnedIpv4Pool;
private final String carrierIp;
private final String publicIp;
private AllocateAddressResponse(BuilderImpl builder) {
super(builder);
this.allocationId = builder.allocationId;
this.publicIpv4Pool = builder.publicIpv4Pool;
this.networkBorderGroup = builder.networkBorderGroup;
this.domain = builder.domain;
this.customerOwnedIp = builder.customerOwnedIp;
this.customerOwnedIpv4Pool = builder.customerOwnedIpv4Pool;
this.carrierIp = builder.carrierIp;
this.publicIp = builder.publicIp;
}
/**
*
* The ID that represents the allocation of the Elastic IP address.
*
*
* @return The ID that represents the allocation of the Elastic IP address.
*/
public final String allocationId() {
return allocationId;
}
/**
*
* The ID of an address pool.
*
*
* @return The ID of an address pool.
*/
public final String publicIpv4Pool() {
return publicIpv4Pool;
}
/**
*
* The set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises IP
* addresses.
*
*
* @return The set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises
* IP addresses.
*/
public final String networkBorderGroup() {
return networkBorderGroup;
}
/**
*
* The network (vpc
).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #domain} will
* return {@link DomainType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #domainAsString}.
*
*
* @return The network (vpc
).
* @see DomainType
*/
public final DomainType domain() {
return DomainType.fromValue(domain);
}
/**
*
* The network (vpc
).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #domain} will
* return {@link DomainType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #domainAsString}.
*
*
* @return The network (vpc
).
* @see DomainType
*/
public final String domainAsString() {
return domain;
}
/**
*
* The customer-owned IP address.
*
*
* @return The customer-owned IP address.
*/
public final String customerOwnedIp() {
return customerOwnedIp;
}
/**
*
* The ID of the customer-owned address pool.
*
*
* @return The ID of the customer-owned address pool.
*/
public final String customerOwnedIpv4Pool() {
return customerOwnedIpv4Pool;
}
/**
*
* The carrier IP address. This option is only available for network interfaces that reside in a subnet in a
* Wavelength Zone.
*
*
* @return The carrier IP address. This option is only available for network interfaces that reside in a subnet in a
* Wavelength Zone.
*/
public final String carrierIp() {
return carrierIp;
}
/**
*
* The Elastic IP address.
*
*
* @return The Elastic IP address.
*/
public final String publicIp() {
return publicIp;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(allocationId());
hashCode = 31 * hashCode + Objects.hashCode(publicIpv4Pool());
hashCode = 31 * hashCode + Objects.hashCode(networkBorderGroup());
hashCode = 31 * hashCode + Objects.hashCode(domainAsString());
hashCode = 31 * hashCode + Objects.hashCode(customerOwnedIp());
hashCode = 31 * hashCode + Objects.hashCode(customerOwnedIpv4Pool());
hashCode = 31 * hashCode + Objects.hashCode(carrierIp());
hashCode = 31 * hashCode + Objects.hashCode(publicIp());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AllocateAddressResponse)) {
return false;
}
AllocateAddressResponse other = (AllocateAddressResponse) obj;
return Objects.equals(allocationId(), other.allocationId()) && Objects.equals(publicIpv4Pool(), other.publicIpv4Pool())
&& Objects.equals(networkBorderGroup(), other.networkBorderGroup())
&& Objects.equals(domainAsString(), other.domainAsString())
&& Objects.equals(customerOwnedIp(), other.customerOwnedIp())
&& Objects.equals(customerOwnedIpv4Pool(), other.customerOwnedIpv4Pool())
&& Objects.equals(carrierIp(), other.carrierIp()) && Objects.equals(publicIp(), other.publicIp());
}
/**
* 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("AllocateAddressResponse").add("AllocationId", allocationId())
.add("PublicIpv4Pool", publicIpv4Pool()).add("NetworkBorderGroup", networkBorderGroup())
.add("Domain", domainAsString()).add("CustomerOwnedIp", customerOwnedIp())
.add("CustomerOwnedIpv4Pool", customerOwnedIpv4Pool()).add("CarrierIp", carrierIp()).add("PublicIp", publicIp())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AllocationId":
return Optional.ofNullable(clazz.cast(allocationId()));
case "PublicIpv4Pool":
return Optional.ofNullable(clazz.cast(publicIpv4Pool()));
case "NetworkBorderGroup":
return Optional.ofNullable(clazz.cast(networkBorderGroup()));
case "Domain":
return Optional.ofNullable(clazz.cast(domainAsString()));
case "CustomerOwnedIp":
return Optional.ofNullable(clazz.cast(customerOwnedIp()));
case "CustomerOwnedIpv4Pool":
return Optional.ofNullable(clazz.cast(customerOwnedIpv4Pool()));
case "CarrierIp":
return Optional.ofNullable(clazz.cast(carrierIp()));
case "PublicIp":
return Optional.ofNullable(clazz.cast(publicIp()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function