software.amazon.awssdk.services.ec2.model.PrivateDnsNameOptionsOnLaunch 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.io.Serializable;
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;
/**
*
* Describes the options for instance hostnames.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PrivateDnsNameOptionsOnLaunch implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField HOSTNAME_TYPE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("HostnameType")
.getter(getter(PrivateDnsNameOptionsOnLaunch::hostnameTypeAsString))
.setter(setter(Builder::hostnameType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HostnameType")
.unmarshallLocationName("hostnameType").build()).build();
private static final SdkField ENABLE_RESOURCE_NAME_DNS_A_RECORD_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("EnableResourceNameDnsARecord")
.getter(getter(PrivateDnsNameOptionsOnLaunch::enableResourceNameDnsARecord))
.setter(setter(Builder::enableResourceNameDnsARecord))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableResourceNameDnsARecord")
.unmarshallLocationName("enableResourceNameDnsARecord").build()).build();
private static final SdkField ENABLE_RESOURCE_NAME_DNS_AAAA_RECORD_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("EnableResourceNameDnsAAAARecord")
.getter(getter(PrivateDnsNameOptionsOnLaunch::enableResourceNameDnsAAAARecord))
.setter(setter(Builder::enableResourceNameDnsAAAARecord))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableResourceNameDnsAAAARecord")
.unmarshallLocationName("enableResourceNameDnsAAAARecord").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(HOSTNAME_TYPE_FIELD,
ENABLE_RESOURCE_NAME_DNS_A_RECORD_FIELD, ENABLE_RESOURCE_NAME_DNS_AAAA_RECORD_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("HostnameType", HOSTNAME_TYPE_FIELD);
put("EnableResourceNameDnsARecord", ENABLE_RESOURCE_NAME_DNS_A_RECORD_FIELD);
put("EnableResourceNameDnsAAAARecord", ENABLE_RESOURCE_NAME_DNS_AAAA_RECORD_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String hostnameType;
private final Boolean enableResourceNameDnsARecord;
private final Boolean enableResourceNameDnsAAAARecord;
private PrivateDnsNameOptionsOnLaunch(BuilderImpl builder) {
this.hostnameType = builder.hostnameType;
this.enableResourceNameDnsARecord = builder.enableResourceNameDnsARecord;
this.enableResourceNameDnsAAAARecord = builder.enableResourceNameDnsAAAARecord;
}
/**
*
* The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance
* IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack
* subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #hostnameType} will
* return {@link HostnameType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #hostnameTypeAsString}.
*
*
* @return The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the
* instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For
* dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
* @see HostnameType
*/
public final HostnameType hostnameType() {
return HostnameType.fromValue(hostnameType);
}
/**
*
* The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance
* IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack
* subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #hostnameType} will
* return {@link HostnameType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #hostnameTypeAsString}.
*
*
* @return The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the
* instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For
* dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
* @see HostnameType
*/
public final String hostnameTypeAsString() {
return hostnameType;
}
/**
*
* Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
*
*
* @return Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
*/
public final Boolean enableResourceNameDnsARecord() {
return enableResourceNameDnsARecord;
}
/**
*
* Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
*
*
* @return Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
*/
public final Boolean enableResourceNameDnsAAAARecord() {
return enableResourceNameDnsAAAARecord;
}
@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(hostnameTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(enableResourceNameDnsARecord());
hashCode = 31 * hashCode + Objects.hashCode(enableResourceNameDnsAAAARecord());
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 PrivateDnsNameOptionsOnLaunch)) {
return false;
}
PrivateDnsNameOptionsOnLaunch other = (PrivateDnsNameOptionsOnLaunch) obj;
return Objects.equals(hostnameTypeAsString(), other.hostnameTypeAsString())
&& Objects.equals(enableResourceNameDnsARecord(), other.enableResourceNameDnsARecord())
&& Objects.equals(enableResourceNameDnsAAAARecord(), other.enableResourceNameDnsAAAARecord());
}
/**
* 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("PrivateDnsNameOptionsOnLaunch").add("HostnameType", hostnameTypeAsString())
.add("EnableResourceNameDnsARecord", enableResourceNameDnsARecord())
.add("EnableResourceNameDnsAAAARecord", enableResourceNameDnsAAAARecord()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "HostnameType":
return Optional.ofNullable(clazz.cast(hostnameTypeAsString()));
case "EnableResourceNameDnsARecord":
return Optional.ofNullable(clazz.cast(enableResourceNameDnsARecord()));
case "EnableResourceNameDnsAAAARecord":
return Optional.ofNullable(clazz.cast(enableResourceNameDnsAAAARecord()));
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