/* * Copyright 2018-2023 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 com.amazonaws.services.autoscaling.model; import java.io.Serializable; import javax.annotation.Generated; /** *

* Describes the desired configuration for an instance refresh. *

*

* If you specify a desired configuration, you must specify either a LaunchTemplate or a * MixedInstancesPolicy. *

* * @see AWS * API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class DesiredConfiguration implements Serializable, Cloneable { /** *

* Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to launch * Amazon EC2 instances. For more information about launch templates, see Launch templates in the * Amazon EC2 Auto Scaling User Guide. *

*/ private LaunchTemplateSpecification launchTemplate; /** *

* Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single * Auto Scaling group. *

*

* A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help * optimize your costs. For more information, see Auto * Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User * Guide. *

*/ private MixedInstancesPolicy mixedInstancesPolicy; /** *

* Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to launch * Amazon EC2 instances. For more information about launch templates, see Launch templates in the * Amazon EC2 Auto Scaling User Guide. *

* * @param launchTemplate * Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to * launch Amazon EC2 instances. For more information about launch templates, see Launch templates in * the Amazon EC2 Auto Scaling User Guide. */ public void setLaunchTemplate(LaunchTemplateSpecification launchTemplate) { this.launchTemplate = launchTemplate; } /** *

* Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to launch * Amazon EC2 instances. For more information about launch templates, see Launch templates in the * Amazon EC2 Auto Scaling User Guide. *

* * @return Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to * launch Amazon EC2 instances. For more information about launch templates, see Launch templates in * the Amazon EC2 Auto Scaling User Guide. */ public LaunchTemplateSpecification getLaunchTemplate() { return this.launchTemplate; } /** *

* Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to launch * Amazon EC2 instances. For more information about launch templates, see Launch templates in the * Amazon EC2 Auto Scaling User Guide. *

* * @param launchTemplate * Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to * launch Amazon EC2 instances. For more information about launch templates, see Launch templates in * the Amazon EC2 Auto Scaling User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public DesiredConfiguration withLaunchTemplate(LaunchTemplateSpecification launchTemplate) { setLaunchTemplate(launchTemplate); return this; } /** *

* Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single * Auto Scaling group. *

*

* A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help * optimize your costs. For more information, see Auto * Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User * Guide. *

* * @param mixedInstancesPolicy * Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a * single Auto Scaling group.

*

* A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and * help optimize your costs. For more information, see Auto * Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling * User Guide. */ public void setMixedInstancesPolicy(MixedInstancesPolicy mixedInstancesPolicy) { this.mixedInstancesPolicy = mixedInstancesPolicy; } /** *

* Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single * Auto Scaling group. *

*

* A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help * optimize your costs. For more information, see Auto * Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User * Guide. *

* * @return Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a * single Auto Scaling group.

*

* A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances * and help optimize your costs. For more information, see Auto * Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling * User Guide. */ public MixedInstancesPolicy getMixedInstancesPolicy() { return this.mixedInstancesPolicy; } /** *

* Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single * Auto Scaling group. *

*

* A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help * optimize your costs. For more information, see Auto * Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User * Guide. *

* * @param mixedInstancesPolicy * Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a * single Auto Scaling group.

*

* A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and * help optimize your costs. For more information, see Auto * Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling * User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public DesiredConfiguration withMixedInstancesPolicy(MixedInstancesPolicy mixedInstancesPolicy) { setMixedInstancesPolicy(mixedInstancesPolicy); return this; } /** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getLaunchTemplate() != null) sb.append("LaunchTemplate: ").append(getLaunchTemplate()).append(","); if (getMixedInstancesPolicy() != null) sb.append("MixedInstancesPolicy: ").append(getMixedInstancesPolicy()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DesiredConfiguration == false) return false; DesiredConfiguration other = (DesiredConfiguration) obj; if (other.getLaunchTemplate() == null ^ this.getLaunchTemplate() == null) return false; if (other.getLaunchTemplate() != null && other.getLaunchTemplate().equals(this.getLaunchTemplate()) == false) return false; if (other.getMixedInstancesPolicy() == null ^ this.getMixedInstancesPolicy() == null) return false; if (other.getMixedInstancesPolicy() != null && other.getMixedInstancesPolicy().equals(this.getMixedInstancesPolicy()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getLaunchTemplate() == null) ? 0 : getLaunchTemplate().hashCode()); hashCode = prime * hashCode + ((getMixedInstancesPolicy() == null) ? 0 : getMixedInstancesPolicy().hashCode()); return hashCode; } @Override public DesiredConfiguration clone() { try { return (DesiredConfiguration) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }