/* * 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.lightsail.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Describes the Amazon Elastic Compute Cloud instance and related resources to be created using the * create cloud formation stack operation. *

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

* The name of the export snapshot record, which contains the exported Lightsail instance snapshot that will be used * as the source of the new Amazon EC2 instance. *

*

* Use the get export snapshot records operation to get a list of export snapshot records that you can * use to create a CloudFormation stack. *

*/ private String sourceName; /** *

* The instance type (e.g., t2.micro) to use for the new Amazon EC2 instance. *

*/ private String instanceType; /** *

* The port configuration to use for the new Amazon EC2 instance. *

*

* The following configuration options are available: *

* * *

* If you configured lightsail-connect as a cidrListAliases on your instance, or if you * chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that configuration is * not carried over to your new Amazon EC2 instance. *

*
*/ private String portInfoSource; /** *

* A launch script you can create that configures a server with additional user data. For example, you might want to * run apt-get -y update. *

* *

* Depending on the machine image you choose, the command to get software on your instance varies. Amazon Linux and * CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses pkg. *

*
*/ private String userData; /** *

* The Availability Zone for the new Amazon EC2 instance. *

*/ private String availabilityZone; /** *

* The name of the export snapshot record, which contains the exported Lightsail instance snapshot that will be used * as the source of the new Amazon EC2 instance. *

*

* Use the get export snapshot records operation to get a list of export snapshot records that you can * use to create a CloudFormation stack. *

* * @param sourceName * The name of the export snapshot record, which contains the exported Lightsail instance snapshot that will * be used as the source of the new Amazon EC2 instance.

*

* Use the get export snapshot records operation to get a list of export snapshot records that * you can use to create a CloudFormation stack. */ public void setSourceName(String sourceName) { this.sourceName = sourceName; } /** *

* The name of the export snapshot record, which contains the exported Lightsail instance snapshot that will be used * as the source of the new Amazon EC2 instance. *

*

* Use the get export snapshot records operation to get a list of export snapshot records that you can * use to create a CloudFormation stack. *

* * @return The name of the export snapshot record, which contains the exported Lightsail instance snapshot that will * be used as the source of the new Amazon EC2 instance.

*

* Use the get export snapshot records operation to get a list of export snapshot records that * you can use to create a CloudFormation stack. */ public String getSourceName() { return this.sourceName; } /** *

* The name of the export snapshot record, which contains the exported Lightsail instance snapshot that will be used * as the source of the new Amazon EC2 instance. *

*

* Use the get export snapshot records operation to get a list of export snapshot records that you can * use to create a CloudFormation stack. *

* * @param sourceName * The name of the export snapshot record, which contains the exported Lightsail instance snapshot that will * be used as the source of the new Amazon EC2 instance.

*

* Use the get export snapshot records operation to get a list of export snapshot records that * you can use to create a CloudFormation stack. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceEntry withSourceName(String sourceName) { setSourceName(sourceName); return this; } /** *

* The instance type (e.g., t2.micro) to use for the new Amazon EC2 instance. *

* * @param instanceType * The instance type (e.g., t2.micro) to use for the new Amazon EC2 instance. */ public void setInstanceType(String instanceType) { this.instanceType = instanceType; } /** *

* The instance type (e.g., t2.micro) to use for the new Amazon EC2 instance. *

* * @return The instance type (e.g., t2.micro) to use for the new Amazon EC2 instance. */ public String getInstanceType() { return this.instanceType; } /** *

* The instance type (e.g., t2.micro) to use for the new Amazon EC2 instance. *

* * @param instanceType * The instance type (e.g., t2.micro) to use for the new Amazon EC2 instance. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceEntry withInstanceType(String instanceType) { setInstanceType(instanceType); return this; } /** *

* The port configuration to use for the new Amazon EC2 instance. *

*

* The following configuration options are available: *

* * *

* If you configured lightsail-connect as a cidrListAliases on your instance, or if you * chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that configuration is * not carried over to your new Amazon EC2 instance. *

*
* * @param portInfoSource * The port configuration to use for the new Amazon EC2 instance.

*

* The following configuration options are available: *

* * *

* If you configured lightsail-connect as a cidrListAliases on your instance, or if * you chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that * configuration is not carried over to your new Amazon EC2 instance. *

* @see PortInfoSourceType */ public void setPortInfoSource(String portInfoSource) { this.portInfoSource = portInfoSource; } /** *

* The port configuration to use for the new Amazon EC2 instance. *

*

* The following configuration options are available: *

* * *

* If you configured lightsail-connect as a cidrListAliases on your instance, or if you * chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that configuration is * not carried over to your new Amazon EC2 instance. *

*
* * @return The port configuration to use for the new Amazon EC2 instance.

*

* The following configuration options are available: *

* * *

* If you configured lightsail-connect as a cidrListAliases on your instance, or * if you chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that * configuration is not carried over to your new Amazon EC2 instance. *

* @see PortInfoSourceType */ public String getPortInfoSource() { return this.portInfoSource; } /** *

* The port configuration to use for the new Amazon EC2 instance. *

*

* The following configuration options are available: *

* * *

* If you configured lightsail-connect as a cidrListAliases on your instance, or if you * chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that configuration is * not carried over to your new Amazon EC2 instance. *

*
* * @param portInfoSource * The port configuration to use for the new Amazon EC2 instance.

*

* The following configuration options are available: *

* * *

* If you configured lightsail-connect as a cidrListAliases on your instance, or if * you chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that * configuration is not carried over to your new Amazon EC2 instance. *

* @return Returns a reference to this object so that method calls can be chained together. * @see PortInfoSourceType */ public InstanceEntry withPortInfoSource(String portInfoSource) { setPortInfoSource(portInfoSource); return this; } /** *

* The port configuration to use for the new Amazon EC2 instance. *

*

* The following configuration options are available: *

*
    *
  • *

    * DEFAULT - Use the default firewall settings from the Lightsail instance blueprint. If this is * specified, then IPv4 and IPv6 will be configured for the new instance that is created in Amazon EC2. *

    *
  • *
  • *

    * INSTANCE - Use the configured firewall settings from the source Lightsail instance. If this is * specified, the new instance that is created in Amazon EC2 will be configured to match the configuration of the * source Lightsail instance. For example, if the source instance is configured for dual-stack (IPv4 and IPv6), then * IPv4 and IPv6 will be configured for the new instance that is created in Amazon EC2. If the source instance is * configured for IPv4 only, then only IPv4 will be configured for the new instance that is created in Amazon EC2. *

    *
  • *
  • *

    * NONE - Use the default Amazon EC2 security group. If this is specified, then only IPv4 will be * configured for the new instance that is created in Amazon EC2. *

    *
  • *
  • *

    * CLOSED - All ports closed. If this is specified, then only IPv4 will be configured for the new * instance that is created in Amazon EC2. *

    *
  • *
* *

* If you configured lightsail-connect as a cidrListAliases on your instance, or if you * chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that configuration is * not carried over to your new Amazon EC2 instance. *

*
* * @param portInfoSource * The port configuration to use for the new Amazon EC2 instance.

*

* The following configuration options are available: *

*
    *
  • *

    * DEFAULT - Use the default firewall settings from the Lightsail instance blueprint. If this is * specified, then IPv4 and IPv6 will be configured for the new instance that is created in Amazon EC2. *

    *
  • *
  • *

    * INSTANCE - Use the configured firewall settings from the source Lightsail instance. If this * is specified, the new instance that is created in Amazon EC2 will be configured to match the configuration * of the source Lightsail instance. For example, if the source instance is configured for dual-stack (IPv4 * and IPv6), then IPv4 and IPv6 will be configured for the new instance that is created in Amazon EC2. If * the source instance is configured for IPv4 only, then only IPv4 will be configured for the new instance * that is created in Amazon EC2. *

    *
  • *
  • *

    * NONE - Use the default Amazon EC2 security group. If this is specified, then only IPv4 will * be configured for the new instance that is created in Amazon EC2. *

    *
  • *
  • *

    * CLOSED - All ports closed. If this is specified, then only IPv4 will be configured for the * new instance that is created in Amazon EC2. *

    *
  • *
* *

* If you configured lightsail-connect as a cidrListAliases on your instance, or if * you chose to allow the Lightsail browser-based SSH or RDP clients to connect to your instance, that * configuration is not carried over to your new Amazon EC2 instance. *

* @return Returns a reference to this object so that method calls can be chained together. * @see PortInfoSourceType */ public InstanceEntry withPortInfoSource(PortInfoSourceType portInfoSource) { this.portInfoSource = portInfoSource.toString(); return this; } /** *

* A launch script you can create that configures a server with additional user data. For example, you might want to * run apt-get -y update. *

* *

* Depending on the machine image you choose, the command to get software on your instance varies. Amazon Linux and * CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses pkg. *

*
* * @param userData * A launch script you can create that configures a server with additional user data. For example, you might * want to run apt-get -y update.

*

* Depending on the machine image you choose, the command to get software on your instance varies. Amazon * Linux and CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses * pkg. *

*/ public void setUserData(String userData) { this.userData = userData; } /** *

* A launch script you can create that configures a server with additional user data. For example, you might want to * run apt-get -y update. *

* *

* Depending on the machine image you choose, the command to get software on your instance varies. Amazon Linux and * CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses pkg. *

*
* * @return A launch script you can create that configures a server with additional user data. For example, you might * want to run apt-get -y update.

*

* Depending on the machine image you choose, the command to get software on your instance varies. Amazon * Linux and CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses * pkg. *

*/ public String getUserData() { return this.userData; } /** *

* A launch script you can create that configures a server with additional user data. For example, you might want to * run apt-get -y update. *

* *

* Depending on the machine image you choose, the command to get software on your instance varies. Amazon Linux and * CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses pkg. *

*
* * @param userData * A launch script you can create that configures a server with additional user data. For example, you might * want to run apt-get -y update.

*

* Depending on the machine image you choose, the command to get software on your instance varies. Amazon * Linux and CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses * pkg. *

* @return Returns a reference to this object so that method calls can be chained together. */ public InstanceEntry withUserData(String userData) { setUserData(userData); return this; } /** *

* The Availability Zone for the new Amazon EC2 instance. *

* * @param availabilityZone * The Availability Zone for the new Amazon EC2 instance. */ public void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; } /** *

* The Availability Zone for the new Amazon EC2 instance. *

* * @return The Availability Zone for the new Amazon EC2 instance. */ public String getAvailabilityZone() { return this.availabilityZone; } /** *

* The Availability Zone for the new Amazon EC2 instance. *

* * @param availabilityZone * The Availability Zone for the new Amazon EC2 instance. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceEntry withAvailabilityZone(String availabilityZone) { setAvailabilityZone(availabilityZone); 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 (getSourceName() != null) sb.append("SourceName: ").append(getSourceName()).append(","); if (getInstanceType() != null) sb.append("InstanceType: ").append(getInstanceType()).append(","); if (getPortInfoSource() != null) sb.append("PortInfoSource: ").append(getPortInfoSource()).append(","); if (getUserData() != null) sb.append("UserData: ").append(getUserData()).append(","); if (getAvailabilityZone() != null) sb.append("AvailabilityZone: ").append(getAvailabilityZone()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof InstanceEntry == false) return false; InstanceEntry other = (InstanceEntry) obj; if (other.getSourceName() == null ^ this.getSourceName() == null) return false; if (other.getSourceName() != null && other.getSourceName().equals(this.getSourceName()) == false) return false; if (other.getInstanceType() == null ^ this.getInstanceType() == null) return false; if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == false) return false; if (other.getPortInfoSource() == null ^ this.getPortInfoSource() == null) return false; if (other.getPortInfoSource() != null && other.getPortInfoSource().equals(this.getPortInfoSource()) == false) return false; if (other.getUserData() == null ^ this.getUserData() == null) return false; if (other.getUserData() != null && other.getUserData().equals(this.getUserData()) == false) return false; if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == null) return false; if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSourceName() == null) ? 0 : getSourceName().hashCode()); hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode()); hashCode = prime * hashCode + ((getPortInfoSource() == null) ? 0 : getPortInfoSource().hashCode()); hashCode = prime * hashCode + ((getUserData() == null) ? 0 : getUserData().hashCode()); hashCode = prime * hashCode + ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone().hashCode()); return hashCode; } @Override public InstanceEntry clone() { try { return (InstanceEntry) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.lightsail.model.transform.InstanceEntryMarshaller.getInstance().marshall(this, protocolMarshaller); } }