com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-elasticloadbalancing Show documentation
/*
* Copyright 2019-2024 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.elasticloadbalancing.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* Contains the parameters for CreateLoadBalancer.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateLoadBalancerRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The name of the load balancer.
*
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32 characters,
* must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
*
*/
private String loadBalancerName;
/**
*
* The listeners.
*
*
* For more information, see Listeners for
* Your Classic Load Balancer in the Classic Load Balancers Guide.
*
*/
private com.amazonaws.internal.SdkInternalList listeners;
/**
*
* One or more Availability Zones from the same region as the load balancer.
*
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
*
*/
private com.amazonaws.internal.SdkInternalList availabilityZones;
/**
*
* The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability Zone
* specified in AvailabilityZones
.
*
*/
private com.amazonaws.internal.SdkInternalList subnets;
/**
*
* The IDs of the security groups to assign to the load balancer.
*
*/
private com.amazonaws.internal.SdkInternalList securityGroups;
/**
*
* The type of a load balancer. Valid only for load balancers in a VPC.
*
*
* By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves to
* public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.
*
*
* Specify internal
to create a load balancer with a DNS name that resolves to private IP addresses.
*
*/
private String scheme;
/**
*
* A list of tags to assign to the load balancer.
*
*
* For more information about tagging your load balancer, see Tag Your Classic Load
* Balancer in the Classic Load Balancers Guide.
*
*/
private com.amazonaws.internal.SdkInternalList tags;
/**
* Default constructor for CreateLoadBalancerRequest object. Callers should use the setter or fluent setter
* (with...) methods to initialize the object after creating it.
*/
public CreateLoadBalancerRequest() {
}
/**
* Constructs a new CreateLoadBalancerRequest object. Callers should use the setter or fluent setter (with...)
* methods to initialize any additional object members.
*
* @param loadBalancerName
* The name of the load balancer.
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32
* characters, must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
*/
public CreateLoadBalancerRequest(String loadBalancerName) {
setLoadBalancerName(loadBalancerName);
}
/**
* Constructs a new CreateLoadBalancerRequest object. Callers should use the setter or fluent setter (with...)
* methods to initialize any additional object members.
*
* @param loadBalancerName
* The name of the load balancer.
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32
* characters, must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
* @param listeners
* The listeners.
*
*
* For more information, see Listeners
* for Your Classic Load Balancer in the Classic Load Balancers Guide.
* @param availabilityZones
* One or more Availability Zones from the same region as the load balancer.
*
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
*/
public CreateLoadBalancerRequest(String loadBalancerName, java.util.List listeners, java.util.List availabilityZones) {
setLoadBalancerName(loadBalancerName);
setListeners(listeners);
setAvailabilityZones(availabilityZones);
}
/**
*
* The name of the load balancer.
*
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32 characters,
* must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
*
*
* @param loadBalancerName
* The name of the load balancer.
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32
* characters, must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
*/
public void setLoadBalancerName(String loadBalancerName) {
this.loadBalancerName = loadBalancerName;
}
/**
*
* The name of the load balancer.
*
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32 characters,
* must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
*
*
* @return The name of the load balancer.
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32
* characters, must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
*/
public String getLoadBalancerName() {
return this.loadBalancerName;
}
/**
*
* The name of the load balancer.
*
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32 characters,
* must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
*
*
* @param loadBalancerName
* The name of the load balancer.
*
* This name must be unique within your set of load balancers for the region, must have a maximum of 32
* characters, must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withLoadBalancerName(String loadBalancerName) {
setLoadBalancerName(loadBalancerName);
return this;
}
/**
*
* The listeners.
*
*
* For more information, see Listeners for
* Your Classic Load Balancer in the Classic Load Balancers Guide.
*
*
* @return The listeners.
*
* For more information, see Listeners
* for Your Classic Load Balancer in the Classic Load Balancers Guide.
*/
public java.util.List getListeners() {
if (listeners == null) {
listeners = new com.amazonaws.internal.SdkInternalList();
}
return listeners;
}
/**
*
* The listeners.
*
*
* For more information, see Listeners for
* Your Classic Load Balancer in the Classic Load Balancers Guide.
*
*
* @param listeners
* The listeners.
*
* For more information, see Listeners
* for Your Classic Load Balancer in the Classic Load Balancers Guide.
*/
public void setListeners(java.util.Collection listeners) {
if (listeners == null) {
this.listeners = null;
return;
}
this.listeners = new com.amazonaws.internal.SdkInternalList(listeners);
}
/**
*
* The listeners.
*
*
* For more information, see Listeners for
* Your Classic Load Balancer in the Classic Load Balancers Guide.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setListeners(java.util.Collection)} or {@link #withListeners(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param listeners
* The listeners.
*
* For more information, see Listeners
* for Your Classic Load Balancer in the Classic Load Balancers Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withListeners(Listener... listeners) {
if (this.listeners == null) {
setListeners(new com.amazonaws.internal.SdkInternalList(listeners.length));
}
for (Listener ele : listeners) {
this.listeners.add(ele);
}
return this;
}
/**
*
* The listeners.
*
*
* For more information, see Listeners for
* Your Classic Load Balancer in the Classic Load Balancers Guide.
*
*
* @param listeners
* The listeners.
*
* For more information, see Listeners
* for Your Classic Load Balancer in the Classic Load Balancers Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withListeners(java.util.Collection listeners) {
setListeners(listeners);
return this;
}
/**
*
* One or more Availability Zones from the same region as the load balancer.
*
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
*
*
* @return One or more Availability Zones from the same region as the load balancer.
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
*/
public java.util.List getAvailabilityZones() {
if (availabilityZones == null) {
availabilityZones = new com.amazonaws.internal.SdkInternalList();
}
return availabilityZones;
}
/**
*
* One or more Availability Zones from the same region as the load balancer.
*
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
*
*
* @param availabilityZones
* One or more Availability Zones from the same region as the load balancer.
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
*/
public void setAvailabilityZones(java.util.Collection availabilityZones) {
if (availabilityZones == null) {
this.availabilityZones = null;
return;
}
this.availabilityZones = new com.amazonaws.internal.SdkInternalList(availabilityZones);
}
/**
*
* One or more Availability Zones from the same region as the load balancer.
*
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setAvailabilityZones(java.util.Collection)} or {@link #withAvailabilityZones(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param availabilityZones
* One or more Availability Zones from the same region as the load balancer.
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withAvailabilityZones(String... availabilityZones) {
if (this.availabilityZones == null) {
setAvailabilityZones(new com.amazonaws.internal.SdkInternalList(availabilityZones.length));
}
for (String ele : availabilityZones) {
this.availabilityZones.add(ele);
}
return this;
}
/**
*
* One or more Availability Zones from the same region as the load balancer.
*
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
*
*
* @param availabilityZones
* One or more Availability Zones from the same region as the load balancer.
*
* You must specify at least one Availability Zone.
*
*
* You can add more Availability Zones after you create the load balancer using
* EnableAvailabilityZonesForLoadBalancer.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withAvailabilityZones(java.util.Collection availabilityZones) {
setAvailabilityZones(availabilityZones);
return this;
}
/**
*
* The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability Zone
* specified in AvailabilityZones
.
*
*
* @return The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability
* Zone specified in AvailabilityZones
.
*/
public java.util.List getSubnets() {
if (subnets == null) {
subnets = new com.amazonaws.internal.SdkInternalList();
}
return subnets;
}
/**
*
* The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability Zone
* specified in AvailabilityZones
.
*
*
* @param subnets
* The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability
* Zone specified in AvailabilityZones
.
*/
public void setSubnets(java.util.Collection subnets) {
if (subnets == null) {
this.subnets = null;
return;
}
this.subnets = new com.amazonaws.internal.SdkInternalList(subnets);
}
/**
*
* The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability Zone
* specified in AvailabilityZones
.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSubnets(java.util.Collection)} or {@link #withSubnets(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param subnets
* The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability
* Zone specified in AvailabilityZones
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withSubnets(String... subnets) {
if (this.subnets == null) {
setSubnets(new com.amazonaws.internal.SdkInternalList(subnets.length));
}
for (String ele : subnets) {
this.subnets.add(ele);
}
return this;
}
/**
*
* The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability Zone
* specified in AvailabilityZones
.
*
*
* @param subnets
* The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability
* Zone specified in AvailabilityZones
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withSubnets(java.util.Collection subnets) {
setSubnets(subnets);
return this;
}
/**
*
* The IDs of the security groups to assign to the load balancer.
*
*
* @return The IDs of the security groups to assign to the load balancer.
*/
public java.util.List getSecurityGroups() {
if (securityGroups == null) {
securityGroups = new com.amazonaws.internal.SdkInternalList();
}
return securityGroups;
}
/**
*
* The IDs of the security groups to assign to the load balancer.
*
*
* @param securityGroups
* The IDs of the security groups to assign to the load balancer.
*/
public void setSecurityGroups(java.util.Collection securityGroups) {
if (securityGroups == null) {
this.securityGroups = null;
return;
}
this.securityGroups = new com.amazonaws.internal.SdkInternalList(securityGroups);
}
/**
*
* The IDs of the security groups to assign to the load balancer.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSecurityGroups(java.util.Collection)} or {@link #withSecurityGroups(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param securityGroups
* The IDs of the security groups to assign to the load balancer.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withSecurityGroups(String... securityGroups) {
if (this.securityGroups == null) {
setSecurityGroups(new com.amazonaws.internal.SdkInternalList(securityGroups.length));
}
for (String ele : securityGroups) {
this.securityGroups.add(ele);
}
return this;
}
/**
*
* The IDs of the security groups to assign to the load balancer.
*
*
* @param securityGroups
* The IDs of the security groups to assign to the load balancer.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withSecurityGroups(java.util.Collection securityGroups) {
setSecurityGroups(securityGroups);
return this;
}
/**
*
* The type of a load balancer. Valid only for load balancers in a VPC.
*
*
* By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves to
* public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.
*
*
* Specify internal
to create a load balancer with a DNS name that resolves to private IP addresses.
*
*
* @param scheme
* The type of a load balancer. Valid only for load balancers in a VPC.
*
* By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves
* to public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.
*
*
* Specify internal
to create a load balancer with a DNS name that resolves to private IP
* addresses.
*/
public void setScheme(String scheme) {
this.scheme = scheme;
}
/**
*
* The type of a load balancer. Valid only for load balancers in a VPC.
*
*
* By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves to
* public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.
*
*
* Specify internal
to create a load balancer with a DNS name that resolves to private IP addresses.
*
*
* @return The type of a load balancer. Valid only for load balancers in a VPC.
*
* By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves
* to public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.
*
*
* Specify internal
to create a load balancer with a DNS name that resolves to private IP
* addresses.
*/
public String getScheme() {
return this.scheme;
}
/**
*
* The type of a load balancer. Valid only for load balancers in a VPC.
*
*
* By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves to
* public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.
*
*
* Specify internal
to create a load balancer with a DNS name that resolves to private IP addresses.
*
*
* @param scheme
* The type of a load balancer. Valid only for load balancers in a VPC.
*
* By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves
* to public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.
*
*
* Specify internal
to create a load balancer with a DNS name that resolves to private IP
* addresses.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withScheme(String scheme) {
setScheme(scheme);
return this;
}
/**
*
* A list of tags to assign to the load balancer.
*
*
* For more information about tagging your load balancer, see Tag Your Classic Load
* Balancer in the Classic Load Balancers Guide.
*
*
* @return A list of tags to assign to the load balancer.
*
* For more information about tagging your load balancer, see Tag Your
* Classic Load Balancer in the Classic Load Balancers Guide.
*/
public java.util.List getTags() {
if (tags == null) {
tags = new com.amazonaws.internal.SdkInternalList();
}
return tags;
}
/**
*
* A list of tags to assign to the load balancer.
*
*
* For more information about tagging your load balancer, see Tag Your Classic Load
* Balancer in the Classic Load Balancers Guide.
*
*
* @param tags
* A list of tags to assign to the load balancer.
*
* For more information about tagging your load balancer, see Tag Your
* Classic Load Balancer in the Classic Load Balancers Guide.
*/
public void setTags(java.util.Collection tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new com.amazonaws.internal.SdkInternalList(tags);
}
/**
*
* A list of tags to assign to the load balancer.
*
*
* For more information about tagging your load balancer, see Tag Your Classic Load
* Balancer in the Classic Load Balancers Guide.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param tags
* A list of tags to assign to the load balancer.
*
* For more information about tagging your load balancer, see Tag Your
* Classic Load Balancer in the Classic Load Balancers Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withTags(Tag... tags) {
if (this.tags == null) {
setTags(new com.amazonaws.internal.SdkInternalList(tags.length));
}
for (Tag ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
*
* A list of tags to assign to the load balancer.
*
*
* For more information about tagging your load balancer, see Tag Your Classic Load
* Balancer in the Classic Load Balancers Guide.
*
*
* @param tags
* A list of tags to assign to the load balancer.
*
* For more information about tagging your load balancer, see Tag Your
* Classic Load Balancer in the Classic Load Balancers Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateLoadBalancerRequest withTags(java.util.Collection tags) {
setTags(tags);
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 (getLoadBalancerName() != null)
sb.append("LoadBalancerName: ").append(getLoadBalancerName()).append(",");
if (getListeners() != null)
sb.append("Listeners: ").append(getListeners()).append(",");
if (getAvailabilityZones() != null)
sb.append("AvailabilityZones: ").append(getAvailabilityZones()).append(",");
if (getSubnets() != null)
sb.append("Subnets: ").append(getSubnets()).append(",");
if (getSecurityGroups() != null)
sb.append("SecurityGroups: ").append(getSecurityGroups()).append(",");
if (getScheme() != null)
sb.append("Scheme: ").append(getScheme()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateLoadBalancerRequest == false)
return false;
CreateLoadBalancerRequest other = (CreateLoadBalancerRequest) obj;
if (other.getLoadBalancerName() == null ^ this.getLoadBalancerName() == null)
return false;
if (other.getLoadBalancerName() != null && other.getLoadBalancerName().equals(this.getLoadBalancerName()) == false)
return false;
if (other.getListeners() == null ^ this.getListeners() == null)
return false;
if (other.getListeners() != null && other.getListeners().equals(this.getListeners()) == false)
return false;
if (other.getAvailabilityZones() == null ^ this.getAvailabilityZones() == null)
return false;
if (other.getAvailabilityZones() != null && other.getAvailabilityZones().equals(this.getAvailabilityZones()) == false)
return false;
if (other.getSubnets() == null ^ this.getSubnets() == null)
return false;
if (other.getSubnets() != null && other.getSubnets().equals(this.getSubnets()) == false)
return false;
if (other.getSecurityGroups() == null ^ this.getSecurityGroups() == null)
return false;
if (other.getSecurityGroups() != null && other.getSecurityGroups().equals(this.getSecurityGroups()) == false)
return false;
if (other.getScheme() == null ^ this.getScheme() == null)
return false;
if (other.getScheme() != null && other.getScheme().equals(this.getScheme()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getLoadBalancerName() == null) ? 0 : getLoadBalancerName().hashCode());
hashCode = prime * hashCode + ((getListeners() == null) ? 0 : getListeners().hashCode());
hashCode = prime * hashCode + ((getAvailabilityZones() == null) ? 0 : getAvailabilityZones().hashCode());
hashCode = prime * hashCode + ((getSubnets() == null) ? 0 : getSubnets().hashCode());
hashCode = prime * hashCode + ((getSecurityGroups() == null) ? 0 : getSecurityGroups().hashCode());
hashCode = prime * hashCode + ((getScheme() == null) ? 0 : getScheme().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public CreateLoadBalancerRequest clone() {
return (CreateLoadBalancerRequest) super.clone();
}
}