software.amazon.awssdk.services.securityhub.model.AwsEc2LaunchTemplateDataPlacementDetails 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.Collections;
import java.util.List;
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;
/**
*
* Provides details about the placement of an Amazon EC2 instance.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AwsEc2LaunchTemplateDataPlacementDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AFFINITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Affinity").getter(getter(AwsEc2LaunchTemplateDataPlacementDetails::affinity))
.setter(setter(Builder::affinity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Affinity").build()).build();
private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AvailabilityZone").getter(getter(AwsEc2LaunchTemplateDataPlacementDetails::availabilityZone))
.setter(setter(Builder::availabilityZone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone").build()).build();
private static final SdkField GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GroupName").getter(getter(AwsEc2LaunchTemplateDataPlacementDetails::groupName))
.setter(setter(Builder::groupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GroupName").build()).build();
private static final SdkField HOST_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("HostId")
.getter(getter(AwsEc2LaunchTemplateDataPlacementDetails::hostId)).setter(setter(Builder::hostId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HostId").build()).build();
private static final SdkField HOST_RESOURCE_GROUP_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HostResourceGroupArn").getter(getter(AwsEc2LaunchTemplateDataPlacementDetails::hostResourceGroupArn))
.setter(setter(Builder::hostResourceGroupArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HostResourceGroupArn").build())
.build();
private static final SdkField PARTITION_NUMBER_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("PartitionNumber").getter(getter(AwsEc2LaunchTemplateDataPlacementDetails::partitionNumber))
.setter(setter(Builder::partitionNumber))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PartitionNumber").build()).build();
private static final SdkField SPREAD_DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SpreadDomain").getter(getter(AwsEc2LaunchTemplateDataPlacementDetails::spreadDomain))
.setter(setter(Builder::spreadDomain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SpreadDomain").build()).build();
private static final SdkField TENANCY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Tenancy")
.getter(getter(AwsEc2LaunchTemplateDataPlacementDetails::tenancy)).setter(setter(Builder::tenancy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tenancy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AFFINITY_FIELD,
AVAILABILITY_ZONE_FIELD, GROUP_NAME_FIELD, HOST_ID_FIELD, HOST_RESOURCE_GROUP_ARN_FIELD, PARTITION_NUMBER_FIELD,
SPREAD_DOMAIN_FIELD, TENANCY_FIELD));
private static final long serialVersionUID = 1L;
private final String affinity;
private final String availabilityZone;
private final String groupName;
private final String hostId;
private final String hostResourceGroupArn;
private final Integer partitionNumber;
private final String spreadDomain;
private final String tenancy;
private AwsEc2LaunchTemplateDataPlacementDetails(BuilderImpl builder) {
this.affinity = builder.affinity;
this.availabilityZone = builder.availabilityZone;
this.groupName = builder.groupName;
this.hostId = builder.hostId;
this.hostResourceGroupArn = builder.hostResourceGroupArn;
this.partitionNumber = builder.partitionNumber;
this.spreadDomain = builder.spreadDomain;
this.tenancy = builder.tenancy;
}
/**
*
* The affinity setting for an instance on an EC2 Dedicated Host.
*
*
* @return The affinity setting for an instance on an EC2 Dedicated Host.
*/
public final String affinity() {
return affinity;
}
/**
*
* The Availability Zone for the instance.
*
*
* @return The Availability Zone for the instance.
*/
public final String availabilityZone() {
return availabilityZone;
}
/**
*
* The name of the placement group for the instance.
*
*
* @return The name of the placement group for the instance.
*/
public final String groupName() {
return groupName;
}
/**
*
* The ID of the Dedicated Host for the instance.
*
*
* @return The ID of the Dedicated Host for the instance.
*/
public final String hostId() {
return hostId;
}
/**
*
* The Amazon Resource Name (ARN) of the host resource group in which to launch the instances.
*
*
* @return The Amazon Resource Name (ARN) of the host resource group in which to launch the instances.
*/
public final String hostResourceGroupArn() {
return hostResourceGroupArn;
}
/**
*
* The number of the partition the instance should launch in.
*
*
* @return The number of the partition the instance should launch in.
*/
public final Integer partitionNumber() {
return partitionNumber;
}
/**
*
* Reserved for future use.
*
*
* @return Reserved for future use.
*/
public final String spreadDomain() {
return spreadDomain;
}
/**
*
* The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs
* on single-tenant hardware.
*
*
* @return The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of
* dedicated runs on single-tenant hardware.
*/
public final String tenancy() {
return tenancy;
}
@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(affinity());
hashCode = 31 * hashCode + Objects.hashCode(availabilityZone());
hashCode = 31 * hashCode + Objects.hashCode(groupName());
hashCode = 31 * hashCode + Objects.hashCode(hostId());
hashCode = 31 * hashCode + Objects.hashCode(hostResourceGroupArn());
hashCode = 31 * hashCode + Objects.hashCode(partitionNumber());
hashCode = 31 * hashCode + Objects.hashCode(spreadDomain());
hashCode = 31 * hashCode + Objects.hashCode(tenancy());
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 AwsEc2LaunchTemplateDataPlacementDetails)) {
return false;
}
AwsEc2LaunchTemplateDataPlacementDetails other = (AwsEc2LaunchTemplateDataPlacementDetails) obj;
return Objects.equals(affinity(), other.affinity()) && Objects.equals(availabilityZone(), other.availabilityZone())
&& Objects.equals(groupName(), other.groupName()) && Objects.equals(hostId(), other.hostId())
&& Objects.equals(hostResourceGroupArn(), other.hostResourceGroupArn())
&& Objects.equals(partitionNumber(), other.partitionNumber())
&& Objects.equals(spreadDomain(), other.spreadDomain()) && Objects.equals(tenancy(), other.tenancy());
}
/**
* 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("AwsEc2LaunchTemplateDataPlacementDetails").add("Affinity", affinity())
.add("AvailabilityZone", availabilityZone()).add("GroupName", groupName()).add("HostId", hostId())
.add("HostResourceGroupArn", hostResourceGroupArn()).add("PartitionNumber", partitionNumber())
.add("SpreadDomain", spreadDomain()).add("Tenancy", tenancy()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Affinity":
return Optional.ofNullable(clazz.cast(affinity()));
case "AvailabilityZone":
return Optional.ofNullable(clazz.cast(availabilityZone()));
case "GroupName":
return Optional.ofNullable(clazz.cast(groupName()));
case "HostId":
return Optional.ofNullable(clazz.cast(hostId()));
case "HostResourceGroupArn":
return Optional.ofNullable(clazz.cast(hostResourceGroupArn()));
case "PartitionNumber":
return Optional.ofNullable(clazz.cast(partitionNumber()));
case "SpreadDomain":
return Optional.ofNullable(clazz.cast(spreadDomain()));
case "Tenancy":
return Optional.ofNullable(clazz.cast(tenancy()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function © 2015 - 2025 Weber Informatics LLC | Privacy Policy