All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.autoscaling.model.AutoScalingInstanceDetails Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Auto Scaling module holds the client classes that are used for communicating with Auto Scaling Service

There is a newer version: 2.29.15
Show newest version
/*
 * 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.autoscaling.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.Consumer;
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 an EC2 instance associated with an Auto Scaling group. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AutoScalingInstanceDetails implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("InstanceId").getter(getter(AutoScalingInstanceDetails::instanceId)).setter(setter(Builder::instanceId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceId").build()).build(); private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("InstanceType").getter(getter(AutoScalingInstanceDetails::instanceType)) .setter(setter(Builder::instanceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build(); private static final SdkField AUTO_SCALING_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AutoScalingGroupName").getter(getter(AutoScalingInstanceDetails::autoScalingGroupName)) .setter(setter(Builder::autoScalingGroupName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingGroupName").build()) .build(); private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AvailabilityZone").getter(getter(AutoScalingInstanceDetails::availabilityZone)) .setter(setter(Builder::availabilityZone)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone").build()).build(); private static final SdkField LIFECYCLE_STATE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LifecycleState").getter(getter(AutoScalingInstanceDetails::lifecycleState)) .setter(setter(Builder::lifecycleState)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LifecycleState").build()).build(); private static final SdkField HEALTH_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("HealthStatus").getter(getter(AutoScalingInstanceDetails::healthStatus)) .setter(setter(Builder::healthStatus)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HealthStatus").build()).build(); private static final SdkField LAUNCH_CONFIGURATION_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LaunchConfigurationName").getter(getter(AutoScalingInstanceDetails::launchConfigurationName)) .setter(setter(Builder::launchConfigurationName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LaunchConfigurationName").build()) .build(); private static final SdkField LAUNCH_TEMPLATE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("LaunchTemplate") .getter(getter(AutoScalingInstanceDetails::launchTemplate)).setter(setter(Builder::launchTemplate)) .constructor(LaunchTemplateSpecification::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LaunchTemplate").build()).build(); private static final SdkField PROTECTED_FROM_SCALE_IN_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("ProtectedFromScaleIn").getter(getter(AutoScalingInstanceDetails::protectedFromScaleIn)) .setter(setter(Builder::protectedFromScaleIn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProtectedFromScaleIn").build()) .build(); private static final SdkField WEIGHTED_CAPACITY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("WeightedCapacity").getter(getter(AutoScalingInstanceDetails::weightedCapacity)) .setter(setter(Builder::weightedCapacity)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WeightedCapacity").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INSTANCE_ID_FIELD, INSTANCE_TYPE_FIELD, AUTO_SCALING_GROUP_NAME_FIELD, AVAILABILITY_ZONE_FIELD, LIFECYCLE_STATE_FIELD, HEALTH_STATUS_FIELD, LAUNCH_CONFIGURATION_NAME_FIELD, LAUNCH_TEMPLATE_FIELD, PROTECTED_FROM_SCALE_IN_FIELD, WEIGHTED_CAPACITY_FIELD)); private static final long serialVersionUID = 1L; private final String instanceId; private final String instanceType; private final String autoScalingGroupName; private final String availabilityZone; private final String lifecycleState; private final String healthStatus; private final String launchConfigurationName; private final LaunchTemplateSpecification launchTemplate; private final Boolean protectedFromScaleIn; private final String weightedCapacity; private AutoScalingInstanceDetails(BuilderImpl builder) { this.instanceId = builder.instanceId; this.instanceType = builder.instanceType; this.autoScalingGroupName = builder.autoScalingGroupName; this.availabilityZone = builder.availabilityZone; this.lifecycleState = builder.lifecycleState; this.healthStatus = builder.healthStatus; this.launchConfigurationName = builder.launchConfigurationName; this.launchTemplate = builder.launchTemplate; this.protectedFromScaleIn = builder.protectedFromScaleIn; this.weightedCapacity = builder.weightedCapacity; } /** *

* The ID of the instance. *

* * @return The ID of the instance. */ public final String instanceId() { return instanceId; } /** *

* The instance type of the EC2 instance. *

* * @return The instance type of the EC2 instance. */ public final String instanceType() { return instanceType; } /** *

* The name of the Auto Scaling group for the instance. *

* * @return The name of the Auto Scaling group for the instance. */ public final String autoScalingGroupName() { return autoScalingGroupName; } /** *

* The Availability Zone for the instance. *

* * @return The Availability Zone for the instance. */ public final String availabilityZone() { return availabilityZone; } /** *

* The lifecycle state for the instance. The Quarantined state is not used. For more information, see * Amazon EC2 Auto * Scaling instance lifecycle in the Amazon EC2 Auto Scaling User Guide. *

*

* Valid values: Pending | Pending:Wait | Pending:Proceed | * Quarantined | InService | Terminating | Terminating:Wait | * Terminating:Proceed | Terminated | Detaching | Detached | * EnteringStandby | Standby | Warmed:Pending | * Warmed:Pending:Wait | Warmed:Pending:Proceed | Warmed:Terminating | * Warmed:Terminating:Wait | Warmed:Terminating:Proceed | Warmed:Terminated | * Warmed:Stopped | Warmed:Running *

* * @return The lifecycle state for the instance. The Quarantined state is not used. For more * information, see Amazon EC2 * Auto Scaling instance lifecycle in the Amazon EC2 Auto Scaling User Guide.

*

* Valid values: Pending | Pending:Wait | Pending:Proceed | * Quarantined | InService | Terminating | * Terminating:Wait | Terminating:Proceed | Terminated | * Detaching | Detached | EnteringStandby | Standby | * Warmed:Pending | Warmed:Pending:Wait | Warmed:Pending:Proceed | * Warmed:Terminating | Warmed:Terminating:Wait | * Warmed:Terminating:Proceed | Warmed:Terminated | Warmed:Stopped | * Warmed:Running */ public final String lifecycleState() { return lifecycleState; } /** *

* The last reported health status of this instance. Healthy means that the instance is healthy and * should remain in service. Unhealthy means that the instance is unhealthy and Amazon EC2 Auto Scaling * should terminate and replace it. *

* * @return The last reported health status of this instance. Healthy means that the instance is healthy * and should remain in service. Unhealthy means that the instance is unhealthy and Amazon EC2 * Auto Scaling should terminate and replace it. */ public final String healthStatus() { return healthStatus; } /** *

* The launch configuration used to launch the instance. This value is not available if you attached the instance to * the Auto Scaling group. *

* * @return The launch configuration used to launch the instance. This value is not available if you attached the * instance to the Auto Scaling group. */ public final String launchConfigurationName() { return launchConfigurationName; } /** *

* The launch template for the instance. *

* * @return The launch template for the instance. */ public final LaunchTemplateSpecification launchTemplate() { return launchTemplate; } /** *

* Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in. *

* * @return Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in. */ public final Boolean protectedFromScaleIn() { return protectedFromScaleIn; } /** *

* The number of capacity units contributed by the instance based on its instance type. *

*

* Valid Range: Minimum value of 1. Maximum value of 999. *

* * @return The number of capacity units contributed by the instance based on its instance type.

*

* Valid Range: Minimum value of 1. Maximum value of 999. */ public final String weightedCapacity() { return weightedCapacity; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(instanceId()); hashCode = 31 * hashCode + Objects.hashCode(instanceType()); hashCode = 31 * hashCode + Objects.hashCode(autoScalingGroupName()); hashCode = 31 * hashCode + Objects.hashCode(availabilityZone()); hashCode = 31 * hashCode + Objects.hashCode(lifecycleState()); hashCode = 31 * hashCode + Objects.hashCode(healthStatus()); hashCode = 31 * hashCode + Objects.hashCode(launchConfigurationName()); hashCode = 31 * hashCode + Objects.hashCode(launchTemplate()); hashCode = 31 * hashCode + Objects.hashCode(protectedFromScaleIn()); hashCode = 31 * hashCode + Objects.hashCode(weightedCapacity()); 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 AutoScalingInstanceDetails)) { return false; } AutoScalingInstanceDetails other = (AutoScalingInstanceDetails) obj; return Objects.equals(instanceId(), other.instanceId()) && Objects.equals(instanceType(), other.instanceType()) && Objects.equals(autoScalingGroupName(), other.autoScalingGroupName()) && Objects.equals(availabilityZone(), other.availabilityZone()) && Objects.equals(lifecycleState(), other.lifecycleState()) && Objects.equals(healthStatus(), other.healthStatus()) && Objects.equals(launchConfigurationName(), other.launchConfigurationName()) && Objects.equals(launchTemplate(), other.launchTemplate()) && Objects.equals(protectedFromScaleIn(), other.protectedFromScaleIn()) && Objects.equals(weightedCapacity(), other.weightedCapacity()); } /** * 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("AutoScalingInstanceDetails").add("InstanceId", instanceId()).add("InstanceType", instanceType()) .add("AutoScalingGroupName", autoScalingGroupName()).add("AvailabilityZone", availabilityZone()) .add("LifecycleState", lifecycleState()).add("HealthStatus", healthStatus()) .add("LaunchConfigurationName", launchConfigurationName()).add("LaunchTemplate", launchTemplate()) .add("ProtectedFromScaleIn", protectedFromScaleIn()).add("WeightedCapacity", weightedCapacity()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "InstanceId": return Optional.ofNullable(clazz.cast(instanceId())); case "InstanceType": return Optional.ofNullable(clazz.cast(instanceType())); case "AutoScalingGroupName": return Optional.ofNullable(clazz.cast(autoScalingGroupName())); case "AvailabilityZone": return Optional.ofNullable(clazz.cast(availabilityZone())); case "LifecycleState": return Optional.ofNullable(clazz.cast(lifecycleState())); case "HealthStatus": return Optional.ofNullable(clazz.cast(healthStatus())); case "LaunchConfigurationName": return Optional.ofNullable(clazz.cast(launchConfigurationName())); case "LaunchTemplate": return Optional.ofNullable(clazz.cast(launchTemplate())); case "ProtectedFromScaleIn": return Optional.ofNullable(clazz.cast(protectedFromScaleIn())); case "WeightedCapacity": return Optional.ofNullable(clazz.cast(weightedCapacity())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AutoScalingInstanceDetails) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the instance. *

* * @param instanceId * The ID of the instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceId(String instanceId); /** *

* The instance type of the EC2 instance. *

* * @param instanceType * The instance type of the EC2 instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceType(String instanceType); /** *

* The name of the Auto Scaling group for the instance. *

* * @param autoScalingGroupName * The name of the Auto Scaling group for the instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder autoScalingGroupName(String autoScalingGroupName); /** *

* The Availability Zone for the instance. *

* * @param availabilityZone * The Availability Zone for the instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder availabilityZone(String availabilityZone); /** *

* The lifecycle state for the instance. The Quarantined state is not used. For more information, * see Amazon * EC2 Auto Scaling instance lifecycle in the Amazon EC2 Auto Scaling User Guide. *

*

* Valid values: Pending | Pending:Wait | Pending:Proceed | * Quarantined | InService | Terminating | Terminating:Wait * | Terminating:Proceed | Terminated | Detaching | Detached * | EnteringStandby | Standby | Warmed:Pending | * Warmed:Pending:Wait | Warmed:Pending:Proceed | Warmed:Terminating | * Warmed:Terminating:Wait | Warmed:Terminating:Proceed | * Warmed:Terminated | Warmed:Stopped | Warmed:Running *

* * @param lifecycleState * The lifecycle state for the instance. The Quarantined state is not used. For more * information, see Amazon * EC2 Auto Scaling instance lifecycle in the Amazon EC2 Auto Scaling User Guide.

*

* Valid values: Pending | Pending:Wait | Pending:Proceed | * Quarantined | InService | Terminating | * Terminating:Wait | Terminating:Proceed | Terminated | * Detaching | Detached | EnteringStandby | Standby | * Warmed:Pending | Warmed:Pending:Wait | Warmed:Pending:Proceed | * Warmed:Terminating | Warmed:Terminating:Wait | * Warmed:Terminating:Proceed | Warmed:Terminated | Warmed:Stopped * | Warmed:Running * @return Returns a reference to this object so that method calls can be chained together. */ Builder lifecycleState(String lifecycleState); /** *

* The last reported health status of this instance. Healthy means that the instance is healthy and * should remain in service. Unhealthy means that the instance is unhealthy and Amazon EC2 Auto * Scaling should terminate and replace it. *

* * @param healthStatus * The last reported health status of this instance. Healthy means that the instance is * healthy and should remain in service. Unhealthy means that the instance is unhealthy and * Amazon EC2 Auto Scaling should terminate and replace it. * @return Returns a reference to this object so that method calls can be chained together. */ Builder healthStatus(String healthStatus); /** *

* The launch configuration used to launch the instance. This value is not available if you attached the * instance to the Auto Scaling group. *

* * @param launchConfigurationName * The launch configuration used to launch the instance. This value is not available if you attached the * instance to the Auto Scaling group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder launchConfigurationName(String launchConfigurationName); /** *

* The launch template for the instance. *

* * @param launchTemplate * The launch template for the instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder launchTemplate(LaunchTemplateSpecification launchTemplate); /** *

* The launch template for the instance. *

* This is a convenience method that creates an instance of the {@link LaunchTemplateSpecification.Builder} * avoiding the need to create one manually via {@link LaunchTemplateSpecification#builder()}. * *

* When the {@link Consumer} completes, {@link LaunchTemplateSpecification.Builder#build()} is called * immediately and its result is passed to {@link #launchTemplate(LaunchTemplateSpecification)}. * * @param launchTemplate * a consumer that will call methods on {@link LaunchTemplateSpecification.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #launchTemplate(LaunchTemplateSpecification) */ default Builder launchTemplate(Consumer launchTemplate) { return launchTemplate(LaunchTemplateSpecification.builder().applyMutation(launchTemplate).build()); } /** *

* Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in. *

* * @param protectedFromScaleIn * Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling * in. * @return Returns a reference to this object so that method calls can be chained together. */ Builder protectedFromScaleIn(Boolean protectedFromScaleIn); /** *

* The number of capacity units contributed by the instance based on its instance type. *

*

* Valid Range: Minimum value of 1. Maximum value of 999. *

* * @param weightedCapacity * The number of capacity units contributed by the instance based on its instance type.

*

* Valid Range: Minimum value of 1. Maximum value of 999. * @return Returns a reference to this object so that method calls can be chained together. */ Builder weightedCapacity(String weightedCapacity); } static final class BuilderImpl implements Builder { private String instanceId; private String instanceType; private String autoScalingGroupName; private String availabilityZone; private String lifecycleState; private String healthStatus; private String launchConfigurationName; private LaunchTemplateSpecification launchTemplate; private Boolean protectedFromScaleIn; private String weightedCapacity; private BuilderImpl() { } private BuilderImpl(AutoScalingInstanceDetails model) { instanceId(model.instanceId); instanceType(model.instanceType); autoScalingGroupName(model.autoScalingGroupName); availabilityZone(model.availabilityZone); lifecycleState(model.lifecycleState); healthStatus(model.healthStatus); launchConfigurationName(model.launchConfigurationName); launchTemplate(model.launchTemplate); protectedFromScaleIn(model.protectedFromScaleIn); weightedCapacity(model.weightedCapacity); } public final String getInstanceId() { return instanceId; } public final void setInstanceId(String instanceId) { this.instanceId = instanceId; } @Override public final Builder instanceId(String instanceId) { this.instanceId = instanceId; return this; } public final String getInstanceType() { return instanceType; } public final void setInstanceType(String instanceType) { this.instanceType = instanceType; } @Override public final Builder instanceType(String instanceType) { this.instanceType = instanceType; return this; } public final String getAutoScalingGroupName() { return autoScalingGroupName; } public final void setAutoScalingGroupName(String autoScalingGroupName) { this.autoScalingGroupName = autoScalingGroupName; } @Override public final Builder autoScalingGroupName(String autoScalingGroupName) { this.autoScalingGroupName = autoScalingGroupName; return this; } public final String getAvailabilityZone() { return availabilityZone; } public final void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; } @Override public final Builder availabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; return this; } public final String getLifecycleState() { return lifecycleState; } public final void setLifecycleState(String lifecycleState) { this.lifecycleState = lifecycleState; } @Override public final Builder lifecycleState(String lifecycleState) { this.lifecycleState = lifecycleState; return this; } public final String getHealthStatus() { return healthStatus; } public final void setHealthStatus(String healthStatus) { this.healthStatus = healthStatus; } @Override public final Builder healthStatus(String healthStatus) { this.healthStatus = healthStatus; return this; } public final String getLaunchConfigurationName() { return launchConfigurationName; } public final void setLaunchConfigurationName(String launchConfigurationName) { this.launchConfigurationName = launchConfigurationName; } @Override public final Builder launchConfigurationName(String launchConfigurationName) { this.launchConfigurationName = launchConfigurationName; return this; } public final LaunchTemplateSpecification.Builder getLaunchTemplate() { return launchTemplate != null ? launchTemplate.toBuilder() : null; } public final void setLaunchTemplate(LaunchTemplateSpecification.BuilderImpl launchTemplate) { this.launchTemplate = launchTemplate != null ? launchTemplate.build() : null; } @Override public final Builder launchTemplate(LaunchTemplateSpecification launchTemplate) { this.launchTemplate = launchTemplate; return this; } public final Boolean getProtectedFromScaleIn() { return protectedFromScaleIn; } public final void setProtectedFromScaleIn(Boolean protectedFromScaleIn) { this.protectedFromScaleIn = protectedFromScaleIn; } @Override public final Builder protectedFromScaleIn(Boolean protectedFromScaleIn) { this.protectedFromScaleIn = protectedFromScaleIn; return this; } public final String getWeightedCapacity() { return weightedCapacity; } public final void setWeightedCapacity(String weightedCapacity) { this.weightedCapacity = weightedCapacity; } @Override public final Builder weightedCapacity(String weightedCapacity) { this.weightedCapacity = weightedCapacity; return this; } @Override public AutoScalingInstanceDetails build() { return new AutoScalingInstanceDetails(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy