com.softlayer.api.service.network.loadbalancer.LoadBalancerService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of softlayer-api-client Show documentation
Show all versions of softlayer-api-client Show documentation
API client for accessing the SoftLayer API
package com.softlayer.api.service.network.loadbalancer;
import com.softlayer.api.ApiClient;
import com.softlayer.api.ResponseHandler;
import com.softlayer.api.annotation.ApiMethod;
import com.softlayer.api.annotation.ApiProperty;
import com.softlayer.api.annotation.ApiType;
import com.softlayer.api.service.Entity;
import com.softlayer.api.service.container.network.loadbalancer.StatusEntry;
import com.softlayer.api.service.network.loadbalancer.VirtualIpAddress;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.concurrent.Future;
/**
* The SoftLayer_Network_LoadBalancer_Service data type contains all the information relating to a specific service (destination) on a particular load balancer.
*
* Information retained on the object itself is the the source and destination of the service, routing type, weight, and whether or not the service is currently enabled.
*
* @see SoftLayer_Network_LoadBalancer_Service
*/
@ApiType("SoftLayer_Network_LoadBalancer_Service")
public class LoadBalancerService extends Entity {
/**
* The load balancer that this service belongs to.
*/
@ApiProperty
protected VirtualIpAddress vip;
public VirtualIpAddress getVip() {
return vip;
}
public void setVip(VirtualIpAddress vip) {
this.vip = vip;
}
/**
* Connection limit on this service.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long connectionLimit;
public Long getConnectionLimit() {
return connectionLimit;
}
public void setConnectionLimit(Long connectionLimit) {
connectionLimitSpecified = true;
this.connectionLimit = connectionLimit;
}
protected boolean connectionLimitSpecified;
public boolean isConnectionLimitSpecified() {
return connectionLimitSpecified;
}
public void unsetConnectionLimit() {
connectionLimit = null;
connectionLimitSpecified = false;
}
/**
* Creation Date of this service
*/
@ApiProperty(canBeNullOrNotSet = true)
protected GregorianCalendar createDate;
public GregorianCalendar getCreateDate() {
return createDate;
}
public void setCreateDate(GregorianCalendar createDate) {
createDateSpecified = true;
this.createDate = createDate;
}
protected boolean createDateSpecified;
public boolean isCreateDateSpecified() {
return createDateSpecified;
}
public void unsetCreateDate() {
createDate = null;
createDateSpecified = false;
}
/**
* The IP Address of the real server you wish to direct traffic to. Your account must own this IP
*/
@ApiProperty(canBeNullOrNotSet = true)
protected String destinationIpAddress;
public String getDestinationIpAddress() {
return destinationIpAddress;
}
public void setDestinationIpAddress(String destinationIpAddress) {
destinationIpAddressSpecified = true;
this.destinationIpAddress = destinationIpAddress;
}
protected boolean destinationIpAddressSpecified;
public boolean isDestinationIpAddressSpecified() {
return destinationIpAddressSpecified;
}
public void unsetDestinationIpAddress() {
destinationIpAddress = null;
destinationIpAddressSpecified = false;
}
/**
* The port on the real server to direct the traffic. This can be different than the source port. If you wish to obfuscate your HTTP traffic, you can accept requests on port 80 on the load balancer, then redirect them to port 932 on your real server.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long destinationPort;
public Long getDestinationPort() {
return destinationPort;
}
public void setDestinationPort(Long destinationPort) {
destinationPortSpecified = true;
this.destinationPort = destinationPort;
}
protected boolean destinationPortSpecified;
public boolean isDestinationPortSpecified() {
return destinationPortSpecified;
}
public void unsetDestinationPort() {
destinationPort = null;
destinationPortSpecified = false;
}
/**
* A flag (either true or false) that determines if this particular service should be enabled on the load balancer. Set to false to bring the server out of rotation without losing your configuration
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Boolean enabled;
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
enabledSpecified = true;
this.enabled = enabled;
}
protected boolean enabledSpecified;
public boolean isEnabledSpecified() {
return enabledSpecified;
}
public void unsetEnabled() {
enabled = null;
enabledSpecified = false;
}
/**
* The health check type for this service. If one is supplied, the load balancer will occasionally ping your server to determine if it is still up. Servers that are down are removed from the queue and will not be used to handle requests until their status returns to "up". The value of the health check is determined directly by what option you have selected for the routing type.
*
* {|
* |-
* ! Type
* ! Valid Health Checks
* |-
* | HTTP
* | HTTP, TCP, ICMP
* |-
* | TCP
* | HTTP, TCP, ICMP
* |-
* | FTP
* | TCP, ICMP
* |-
* | DNS
* | DNS, ICMP
* |-
* | UDP
* | None
* |}
*
*/
@ApiProperty(canBeNullOrNotSet = true)
protected String healthCheck;
public String getHealthCheck() {
return healthCheck;
}
public void setHealthCheck(String healthCheck) {
healthCheckSpecified = true;
this.healthCheck = healthCheck;
}
protected boolean healthCheckSpecified;
public boolean isHealthCheckSpecified() {
return healthCheckSpecified;
}
public void unsetHealthCheck() {
healthCheck = null;
healthCheckSpecified = false;
}
/**
* The URL provided here (starting with /) is what the load balancer will request in order to perform a custom HTTP health check. You must specify either "GET /location/of/file.html" or "HEAD /location/of/file.php"
*/
@ApiProperty(canBeNullOrNotSet = true)
protected String healthCheckURL;
public String getHealthCheckURL() {
return healthCheckURL;
}
public void setHealthCheckURL(String healthCheckURL) {
healthCheckURLSpecified = true;
this.healthCheckURL = healthCheckURL;
}
protected boolean healthCheckURLSpecified;
public boolean isHealthCheckURLSpecified() {
return healthCheckURLSpecified;
}
public void unsetHealthCheckURL() {
healthCheckURL = null;
healthCheckURLSpecified = false;
}
/**
* The expected response from the custom HTTP health check. If the requested page contains this response, the check succeeds.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected String healthResponse;
public String getHealthResponse() {
return healthResponse;
}
public void setHealthResponse(String healthResponse) {
healthResponseSpecified = true;
this.healthResponse = healthResponse;
}
protected boolean healthResponseSpecified;
public boolean isHealthResponseSpecified() {
return healthResponseSpecified;
}
public void unsetHealthResponse() {
healthResponse = null;
healthResponseSpecified = false;
}
/**
* Unique ID for this object, used for the getObject method, and must be set if you are editing this object.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
idSpecified = true;
this.id = id;
}
protected boolean idSpecified;
public boolean isIdSpecified() {
return idSpecified;
}
public void unsetId() {
id = null;
idSpecified = false;
}
/**
* Last modification date of this service
*/
@ApiProperty(canBeNullOrNotSet = true)
protected GregorianCalendar modifyDate;
public GregorianCalendar getModifyDate() {
return modifyDate;
}
public void setModifyDate(GregorianCalendar modifyDate) {
modifyDateSpecified = true;
this.modifyDate = modifyDate;
}
protected boolean modifyDateSpecified;
public boolean isModifyDateSpecified() {
return modifyDateSpecified;
}
public void unsetModifyDate() {
modifyDate = null;
modifyDateSpecified = false;
}
/**
* Name of the load balancer service
*/
@ApiProperty(canBeNullOrNotSet = true)
protected String name;
public String getName() {
return name;
}
public void setName(String name) {
nameSpecified = true;
this.name = name;
}
protected boolean nameSpecified;
public boolean isNameSpecified() {
return nameSpecified;
}
public void unsetName() {
name = null;
nameSpecified = false;
}
/**
* Holds whether this server is up or down. Does not affect load balancer configuration at all, just for the customer's informational purposes
*/
@ApiProperty(canBeNullOrNotSet = true)
protected String notes;
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
notesSpecified = true;
this.notes = notes;
}
protected boolean notesSpecified;
public boolean isNotesSpecified() {
return notesSpecified;
}
public void unsetNotes() {
notes = null;
notesSpecified = false;
}
/**
* Peak historical connections since the creation of this service. Is reset any time you make a configuration change
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long peakConnections;
public Long getPeakConnections() {
return peakConnections;
}
public void setPeakConnections(Long peakConnections) {
peakConnectionsSpecified = true;
this.peakConnections = peakConnections;
}
protected boolean peakConnectionsSpecified;
public boolean isPeakConnectionsSpecified() {
return peakConnectionsSpecified;
}
public void unsetPeakConnections() {
peakConnections = null;
peakConnectionsSpecified = false;
}
/**
* The port on the load balancer that this service maps to. This is the port for incoming traffic, it needs to be shared with other services to form a group.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long sourcePort;
public Long getSourcePort() {
return sourcePort;
}
public void setSourcePort(Long sourcePort) {
sourcePortSpecified = true;
this.sourcePort = sourcePort;
}
protected boolean sourcePortSpecified;
public boolean isSourcePortSpecified() {
return sourcePortSpecified;
}
public void unsetSourcePort() {
sourcePort = null;
sourcePortSpecified = false;
}
/**
* The connection type of this service. Valid values are HTTP, FTP, TCP, UDP, and DNS. The value of this variable affects available values of healthCheck, listed in that variable's description
*/
@ApiProperty(canBeNullOrNotSet = true)
protected String type;
public String getType() {
return type;
}
public void setType(String type) {
typeSpecified = true;
this.type = type;
}
protected boolean typeSpecified;
public boolean isTypeSpecified() {
return typeSpecified;
}
public void unsetType() {
type = null;
typeSpecified = false;
}
/**
* Unique ID for this object's parent. Probably not useful in the API, as this object will always be a child of a VirtualIpAddress anyway.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long vipId;
public Long getVipId() {
return vipId;
}
public void setVipId(Long vipId) {
vipIdSpecified = true;
this.vipId = vipId;
}
protected boolean vipIdSpecified;
public boolean isVipIdSpecified() {
return vipIdSpecified;
}
public void unsetVipId() {
vipId = null;
vipIdSpecified = false;
}
/**
* Weight affects the choices the load balancer makes between your services. The weight of each service is expressed as a percentage of the TOTAL CONNECTION LIMIT on the virtual IP Address. All services draw from the same pool of connections, so if you expect to have 4 times as much HTTP traffic as HTTPS, your weights for the above example routes would be 40%, 40%, 10%, 10% respectively. The weights should add up to 100% If you go over 100%, an exception will be thrown. Weights must be whole numbers, no fractions or decimals are accepted.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long weight;
public Long getWeight() {
return weight;
}
public void setWeight(Long weight) {
weightSpecified = true;
this.weight = weight;
}
protected boolean weightSpecified;
public boolean isWeightSpecified() {
return weightSpecified;
}
public void unsetWeight() {
weight = null;
weightSpecified = false;
}
public Service asService(ApiClient client) {
return service(client, id);
}
public static Service service(ApiClient client) {
return client.createService(Service.class, null);
}
public static Service service(ApiClient client, Long id) {
return client.createService(Service.class, id == null ? null : id.toString());
}
/**
* Load balancer services represent the "routes" that the load balancer will have available to route requests. Each service has a source port (located on the load balancer itself), and a destination IP address and port. Any services that share a source port will be used as potential routes for traffic coming into the load balancer on that port. For instance, if there are two services that both have a source port of 80, both of those services will be used as balanced servers for traffic coming into your virtual IP on port 80. For a more complete example, consider the following scenario:
*
*
* :Virtual IP Address: 123.123.123.123
* :Servers on your account:
* :12.34.56.78
* :23.45.67.89
* :You want to set up both HTTP(port 80) and HTTPS (port 443) on each of those servers.
* :You will need four services:
*
*
* {|
* |-
* ! SourcePort
* ! DestinationIpAddress
* ! DestinationPort
* |-
* | 80
* | 12.34.56.78
* | 80
* |-
* | 80
* | 23.45.67.89
* | 80
* |-
* | 443
* | 12.34.56.78
* | 443
* |-
* | 443
* | 23.45.67.89
* | 443
* |}
*
*
* The services also have a routing type, these ALSO need to be the same for services that share the same port. For this example, the services with a source port of 80 should have HTTP as their type. The other two services should have TCP as their type.
*
* The affect of other variables are listed in their individual documentation.
*
* @see SoftLayer_Network_LoadBalancer_Service
*/
@com.softlayer.api.annotation.ApiService("SoftLayer_Network_LoadBalancer_Service")
public static interface Service extends com.softlayer.api.Service {
public ServiceAsync asAsync();
public Mask withNewMask();
public Mask withMask();
public void setMask(Mask mask);
/**
* Calling deleteObject on a particular server will remove it from the load balancer. This is the only way to remove a service from your load balancer. If you wish to remove a server, first call this function, then reload the virtualIpAddress object and edit the remaining services to reflect the other changes that you wish to make.
*
* @see SoftLayer_Network_LoadBalancer_Service::deleteObject
*/
@ApiMethod(instanceRequired = true)
public Boolean deleteObject();
/**
* Get the graph image for a load balancer service based on the supplied graph type and metric. The available graph types are: 'connections' and 'status', and the available metrics are: 'day', 'week' and 'month'.
*
* This method returns the raw binary image data.
*
* @see SoftLayer_Network_LoadBalancer_Service::getGraphImage
*/
@ApiMethod(instanceRequired = true)
public byte[] getGraphImage(String graphType, String metric);
/**
* getObject retrieves the SoftLayer_Network_LoadBalancer_Service object whose ID number corresponds to the ID number of the init parameter passed to the SoftLayer_Network_LoadBalancer_Service service. You can only retrieve services on load balancers assigned to your account, and it is recommended that you simply retrieve the entire load balancer, as an individual service has no explicit purpose without its "siblings".
*
* @see SoftLayer_Network_LoadBalancer_Service::getObject
*/
@ApiMethod(instanceRequired = true)
public LoadBalancerService getObject();
/**
* Returns an array of SoftLayer_Container_Network_LoadBalancer_StatusEntry objects. A SoftLayer_Container_Network_LoadBalancer_StatusEntry object has two variables, "Label" and "Value"
*
* Calling this function executes a command on the physical load balancer itself, and therefore should be called infrequently. For a general idea of the load balancer service, use the "peakConnections" variable on the Type
*
* Possible values for "Label" are:
*
*
* * IP Address
* * Port
* * Server Status
* * Load Status
* * Current Connections
* * Total Hits
*
*
* Not all labels are guaranteed to be returned.
*
* @see SoftLayer_Network_LoadBalancer_Service::getStatus
*/
@ApiMethod(instanceRequired = true)
public List getStatus();
/**
* Calling resetPeakConnections will set the peakConnections variable to zero on this particular object. Peak connections will continue to increase normally after this method call, it will only temporarily reset the statistic to zero, until the next time it is polled.
*
* @see SoftLayer_Network_LoadBalancer_Service::resetPeakConnections
*/
@ApiMethod(instanceRequired = true)
public Boolean resetPeakConnections();
/**
* The load balancer that this service belongs to.
*
* @see SoftLayer_Network_LoadBalancer_Service::getVip
*/
@ApiMethod(instanceRequired = true)
public VirtualIpAddress getVip();
}
public static interface ServiceAsync extends com.softlayer.api.ServiceAsync {
public Mask withNewMask();
public Mask withMask();
public void setMask(Mask mask);
/**
* Async version of {@link Service#deleteObject}
*/
public Future deleteObject();
public Future> deleteObject(ResponseHandler callback);
/**
* Async version of {@link Service#getGraphImage}
*/
public Future getGraphImage(String graphType, String metric);
public Future> getGraphImage(String graphType, String metric, ResponseHandler callback);
/**
* Async version of {@link Service#getObject}
*/
public Future getObject();
public Future> getObject(ResponseHandler callback);
/**
* Async version of {@link Service#getStatus}
*/
public Future> getStatus();
public Future> getStatus(ResponseHandler> callback);
/**
* Async version of {@link Service#resetPeakConnections}
*/
public Future resetPeakConnections();
public Future> resetPeakConnections(ResponseHandler callback);
/**
* Async version of {@link Service#getVip}
*/
public Future getVip();
/**
* Async callback version of {@link Service#getVip}
*/
public Future> getVip(ResponseHandler callback);
}
public static class Mask extends com.softlayer.api.service.Entity.Mask {
public VirtualIpAddress.Mask vip() {
return withSubMask("vip", VirtualIpAddress.Mask.class);
}
public Mask connectionLimit() {
withLocalProperty("connectionLimit");
return this;
}
public Mask createDate() {
withLocalProperty("createDate");
return this;
}
public Mask destinationIpAddress() {
withLocalProperty("destinationIpAddress");
return this;
}
public Mask destinationPort() {
withLocalProperty("destinationPort");
return this;
}
public Mask enabled() {
withLocalProperty("enabled");
return this;
}
public Mask healthCheck() {
withLocalProperty("healthCheck");
return this;
}
public Mask healthCheckURL() {
withLocalProperty("healthCheckURL");
return this;
}
public Mask healthResponse() {
withLocalProperty("healthResponse");
return this;
}
public Mask id() {
withLocalProperty("id");
return this;
}
public Mask modifyDate() {
withLocalProperty("modifyDate");
return this;
}
public Mask name() {
withLocalProperty("name");
return this;
}
public Mask notes() {
withLocalProperty("notes");
return this;
}
public Mask peakConnections() {
withLocalProperty("peakConnections");
return this;
}
public Mask sourcePort() {
withLocalProperty("sourcePort");
return this;
}
public Mask type() {
withLocalProperty("type");
return this;
}
public Mask vipId() {
withLocalProperty("vipId");
return this;
}
public Mask weight() {
withLocalProperty("weight");
return this;
}
}
}