com.netflix.appinfo
Class InstanceInfo.Builder

java.lang.Object
  extended by com.netflix.appinfo.InstanceInfo.Builder
Enclosing class:
InstanceInfo

public static final class InstanceInfo.Builder
extends java.lang.Object


Constructor Summary
InstanceInfo.Builder(InstanceInfo instanceInfo)
           
 
Method Summary
 InstanceInfo.Builder add(java.lang.String key, java.lang.String val)
          Add arbitrary metadata to running instance
 InstanceInfo build()
          Build the InstanceInfo object.
 InstanceInfo.Builder enablePort(InstanceInfo.PortType type, boolean isEnabled)
          Enabled or disable secure/non-secure ports .
 InstanceInfo getRawInstance()
          Returns the encapsulated instance info even it it is not built fully.
 boolean isInitialized()
           
static InstanceInfo.Builder newBuilder()
           
 InstanceInfo.Builder setAppName(java.lang.String appName)
          Set the application name of the instance.This is mostly used in querying of instances.
 InstanceInfo.Builder setASGName(java.lang.String asgName)
          Sets the AWS ASG name for this instance.
 InstanceInfo.Builder setCountryId(int id)
          Deprecated. 
 InstanceInfo.Builder setDataCenterInfo(DataCenterInfo datacenter)
          Sets the datacenter information.
 InstanceInfo.Builder setHealthCheckUrls(java.lang.String relativeUrl, java.lang.String explicitUrl, java.lang.String secureExplicitUrl)
          Sets the absolute health check URL for this instance for both secure and non-secure communication The users can provide the healthCheckUrlPath if the healthcheck page resides in the same instance talking to discovery, else in the cases where the instance is a proxy for some other server, it can provide the full URL.
 InstanceInfo.Builder setHomePageUrl(java.lang.String relativeUrl, java.lang.String explicitUrl)
          Sets the absolute home page URL for this instance.
 InstanceInfo.Builder setHostName(java.lang.String hostName)
          Sets the fully qualified hostname of this running instance.This is mostly used in constructing the URL for communicating with the instance.
 InstanceInfo.Builder setIPAddr(java.lang.String ip)
          Sets the ip address of this running instance.
 void setLeaseInfo(LeaseInfo info)
          Set the instance lease information.
 InstanceInfo.Builder setMetadata(java.util.Map<java.lang.String,java.lang.String> mt)
          Replace the existing metadata map with a new one.
 InstanceInfo.Builder setNamespace(java.lang.String namespace)
           
 InstanceInfo.Builder setOverriddenStatus(InstanceInfo.InstanceStatus status)
          Sets the status overridden by some other external process.This is mostly used in putting an instance out of service to block traffic to it.
 InstanceInfo.Builder setPort(int port)
          Sets the port number that is used to service requests.
 InstanceInfo.Builder setSecurePort(int port)
          Sets the secure port that is used to service requests.
 InstanceInfo.Builder setSecureVIPAddress(java.lang.String secureVIPAddress)
          Sets the Secure Virtual Internet Protocol address for this instance.
 InstanceInfo.Builder setSID(java.lang.String sid)
          Deprecated. 
 InstanceInfo.Builder setStatus(InstanceInfo.InstanceStatus status)
          Sets the status of the instances.If the status is UP, that is when the instance is ready to service requests.
 InstanceInfo.Builder setStatusPageUrl(java.lang.String relativeUrl, java.lang.String explicitUrl)
          Sets the absolute status page URL for this instance.
 InstanceInfo.Builder setVIPAddress(java.lang.String vipAddress)
          Sets the Virtual Internet Protocol address for this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceInfo.Builder

public InstanceInfo.Builder(InstanceInfo instanceInfo)
Method Detail

newBuilder

public static InstanceInfo.Builder newBuilder()

setAppName

public InstanceInfo.Builder setAppName(java.lang.String appName)
Set the application name of the instance.This is mostly used in querying of instances.

Parameters:
appName - the application name.
Returns:
the instance info builder.

setHostName

public InstanceInfo.Builder setHostName(java.lang.String hostName)
Sets the fully qualified hostname of this running instance.This is mostly used in constructing the URL for communicating with the instance.

Parameters:
hostName - the host name of the instance.
Returns:
the InstanceInfo builder.

setStatus

public InstanceInfo.Builder setStatus(InstanceInfo.InstanceStatus status)
Sets the status of the instances.If the status is UP, that is when the instance is ready to service requests.

Parameters:
status - the InstanceInfo.InstanceStatus of the instance.
Returns:
the InstanceInfo builder.

setOverriddenStatus

public InstanceInfo.Builder setOverriddenStatus(InstanceInfo.InstanceStatus status)
Sets the status overridden by some other external process.This is mostly used in putting an instance out of service to block traffic to it.

Parameters:
status - the overridden InstanceInfo.InstanceStatus of the instance.
Returns:
@return the InstanceInfo builder.

setIPAddr

public InstanceInfo.Builder setIPAddr(java.lang.String ip)
Sets the ip address of this running instance.

Parameters:
ip - the ip address of the instance.
Returns:
the InstanceInfo builder.

setSID

@Deprecated
public InstanceInfo.Builder setSID(java.lang.String sid)
Deprecated. 

Sets the identity of this application instance.

Parameters:
sid - the sid of the instance.
Returns:
the InstanceInfo builder.

setPort

public InstanceInfo.Builder setPort(int port)
Sets the port number that is used to service requests.

Parameters:
port - the port number that is used to service requests.
Returns:
the InstanceInfo builder.

setSecurePort

public InstanceInfo.Builder setSecurePort(int port)
Sets the secure port that is used to service requests.

Parameters:
port - the secure port that is used to service requests.
Returns:
the InstanceInfo builder.

enablePort

public InstanceInfo.Builder enablePort(InstanceInfo.PortType type,
                                       boolean isEnabled)
Enabled or disable secure/non-secure ports .

Parameters:
type - Secure or Non-Secure.
isEnabled - true if enabled.
Returns:
the instance builder.

setCountryId

@Deprecated
public InstanceInfo.Builder setCountryId(int id)
Deprecated. 


setHomePageUrl

public InstanceInfo.Builder setHomePageUrl(java.lang.String relativeUrl,
                                           java.lang.String explicitUrl)
Sets the absolute home page URL for this instance. The users can provide the homePageUrlPath if the home page resides in the same instance talking to discovery, else in the cases where the instance is a proxy for some other server, it can provide the full URL. If the full URL is provided it takes precedence.

The full URL should follow the format http://${netflix.appinfo.hostname}:7001/ where the value ${netflix.appinfo.hostname} is replaced at runtime.

Parameters:
relativeUrl - the relative url path of the home page.
explicitUrl - - The full URL for the home page
Returns:
the instance builder.

setStatusPageUrl

public InstanceInfo.Builder setStatusPageUrl(java.lang.String relativeUrl,
                                             java.lang.String explicitUrl)
Sets the absolute status page URL for this instance. The users can provide the statusPageUrlPath if the status page resides in the same instance talking to discovery, else in the cases where the instance is a proxy for some other server, it can provide the full URL. If the full URL is provided it takes precedence.

The full URL should follow the format http://${netflix.appinfo.hostname}:7001/Status where the value ${netflix.appinfo.hostname} is replaced at runtime.

Parameters:
relativeUrl - - The URL path for status page for this instance
explicitUrl - - The full URL for the status page
Returns:
- Builder instance

setHealthCheckUrls

public InstanceInfo.Builder setHealthCheckUrls(java.lang.String relativeUrl,
                                               java.lang.String explicitUrl,
                                               java.lang.String secureExplicitUrl)
Sets the absolute health check URL for this instance for both secure and non-secure communication The users can provide the healthCheckUrlPath if the healthcheck page resides in the same instance talking to discovery, else in the cases where the instance is a proxy for some other server, it can provide the full URL. If the full URL is provided it takes precedence.

The full URL should follow the format http://${netflix.appinfo.hostname}:7001/healthcheck where the value ${netflix.appinfo.hostname} is replaced at runtime.

Parameters:
relativeUrl - - The URL path for healthcheck page for this instance.
explicitUrl - - The full URL for the healthcheck page.
secureExplicitUrl - the full secure explicit url of the healthcheck page.
Returns:
the instance builder

setVIPAddress

public InstanceInfo.Builder setVIPAddress(java.lang.String vipAddress)
Sets the Virtual Internet Protocol address for this instance. The address should follow the format This address needs to be resolved into a real address for communicating with this instance.

Parameters:
vipAddress - - The Virtual Internet Protocol address of this instance.
Returns:
the instance builder.

setSecureVIPAddress

public InstanceInfo.Builder setSecureVIPAddress(java.lang.String secureVIPAddress)
Sets the Secure Virtual Internet Protocol address for this instance. The address should follow the format This address needs to be resolved into a real address for communicating with this instance.

Parameters:
secureVIPAddress - the secure VIP address of the instance.
Returns:
- Builder instance

setDataCenterInfo

public InstanceInfo.Builder setDataCenterInfo(DataCenterInfo datacenter)
Sets the datacenter information.

Parameters:
datacenter - the datacenter information for where this instance is running.
Returns:
the InstanceInfo builder.

setLeaseInfo

public void setLeaseInfo(LeaseInfo info)
Set the instance lease information.

Parameters:
info - the lease information for this instance.

add

public InstanceInfo.Builder add(java.lang.String key,
                                java.lang.String val)
Add arbitrary metadata to running instance

Parameters:
key - The key of the metadata.
val - The value of the metadata.
Returns:
the InstanceInfo builder.

setMetadata

public InstanceInfo.Builder setMetadata(java.util.Map<java.lang.String,java.lang.String> mt)
Replace the existing metadata map with a new one.

Parameters:
mt - the new metadata name.
Returns:
instance info builder.

getRawInstance

public InstanceInfo getRawInstance()
Returns the encapsulated instance info even it it is not built fully.

Returns:
the existing information about the instance.

build

public InstanceInfo build()
Build the InstanceInfo object.

Returns:
the InstanceInfo that was built based on the information supplied.

isInitialized

public boolean isInitialized()

setASGName

public InstanceInfo.Builder setASGName(java.lang.String asgName)
Sets the AWS ASG name for this instance.

Parameters:
asgName - the asg name for this instance.
Returns:
the instance info builder.

setNamespace

public InstanceInfo.Builder setNamespace(java.lang.String namespace)