Class InstanceInfo
java.lang.Object
io.micronaut.discovery.eureka.client.v2.InstanceInfo
- All Implemented Interfaces:
ConfigurableInstanceInfo
Represents an application instance in Eureka. See https://github.com/Netflix/eureka/wiki/Eureka-REST-operations.
Based on https://github.com/Netflix/eureka/blob/master/eureka-client/src/main/java/com/netflix/appinfo/InstanceInfo.java
- Since:
- 1.0
- Author:
- graemerocher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe instance status according to Eureka. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intUS by default.static final intEureka default port.static final intSecure port disabled by default. -
Constructor Summary
ConstructorsConstructorDescriptionInstanceInfo(String host, int port, @NotBlank String appName, @NotBlank String instanceId) Creates anInstanceInfo.InstanceInfo(String host, int port, String ipAddress, String appName, String instanceId) Creates anInstanceInfo.InstanceInfo(String host, @NotBlank String appName) Creates anInstanceInfo.InstanceInfo(String host, @NotBlank String appName, @NotBlank String instanceId) Creates anInstanceInfo. -
Method Summary
Modifier and TypeMethodDescription@NotBlank StringgetApp()The application name.The application group name.@jakarta.validation.constraints.Min(1L) intThe country id.@NotNull DataCenterInfoTheDataCenterInfoinstance.@NotBlank StringThe host name of the application instance.getId()Returns the unique id of the instance.@NotBlank StringThe instance id.@NotBlank StringThe IP address of the instance.TheLeaseInfoinstance.intgetPort()The port of the application instance.io.micronaut.discovery.eureka.client.v2.InstanceInfo.PortWrapperintThe secure port of the application instance.io.micronaut.discovery.eureka.client.v2.InstanceInfo.PortWrapper@NotBlank String@NotNull InstanceInfo.Status@NotBlank StringvoidsetAppGroupName(String appGroupName) Sets the application group name.voidsetAsgName(String asgName) Sets the Amazon auto scaling group name to use.voidsetCountryId(int countryId) Sets the country id.voidsetDataCenterInfo(DataCenterInfo dataCenterInfo) Sets theDataCenterInfo.voidsetHealthCheckUrl(String healthCheckUrl) Sets the health check URL.voidsetHomePageUrl(String homePageUrl) Sets the home page URL.voidsetInstanceId(String instanceId) Sets the instance ID.voidSets the IP address of the instance.voidsetLeaseInfo(LeaseInfo leaseInfo) Sets theLeaseInfo.voidsetMetadata(Map<String, String> metadata) voidsetPort(int port) Sets the port of the application instance.voidsetSecureHealthCheckUrl(String secureHealthCheckUrl) Sets the secure health check URL.voidsetSecurePort(int securePort) Sets the secure port of the application instance.voidsetSecureVipAddress(String secureVipAddress) Sets the Secure Virtual Host Address.voidsetStatus(InstanceInfo.Status status) Sets the application status.voidsetStatusPageUrl(String statusPageUrl) Sets the status page URL.voidsetVipAddress(String vipAddress) Sets the Virtual Host Address.toString()
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORTEureka default port.- See Also:
-
DEFAULT_SECURE_PORT
public static final int DEFAULT_SECURE_PORTSecure port disabled by default.- See Also:
-
DEFAULT_COUNTRY_ID
public static final int DEFAULT_COUNTRY_IDUS by default.- See Also:
-
-
Constructor Details
-
InstanceInfo
public InstanceInfo(String host, @NotBlank @NotBlank String appName, @NotBlank @NotBlank String instanceId) Creates anInstanceInfo.- Parameters:
host- The host nameappName- The application nameinstanceId- The instance identifier
-
InstanceInfo
Creates anInstanceInfo. ThegetInstanceId()will default to the value of the host- Parameters:
host- The host nameappName- The application name
-
InstanceInfo
public InstanceInfo(String host, int port, @NotBlank @NotBlank String appName, @NotBlank @NotBlank String instanceId) Creates anInstanceInfo. This constructor will perform an IP Address lookup based on the host name- Parameters:
host- The host nameport- The portappName- The application nameinstanceId- The instance identifier
-
InstanceInfo
Creates anInstanceInfo.- Parameters:
host- The host nameport- The portipAddress- The IP addressappName- The application nameinstanceId- The instance identifier
-
-
Method Details
-
toString
-
getHostName
The host name of the application instance.- Specified by:
getHostNamein interfaceConfigurableInstanceInfo- Returns:
- The hostname
-
getId
Returns the unique id of the instance. (Note) now that id is set at creation time within the instanceProvider, why do the other checks? This is still necessary for backwards compatibility when upgrading in a deployment with multiple client versions (some with the change, some without).- Specified by:
getIdin interfaceConfigurableInstanceInfo- Returns:
- the unique id.
-
getPort
public int getPort()The port of the application instance.- Specified by:
getPortin interfaceConfigurableInstanceInfo- Returns:
- The port
-
getSecurePort
public int getSecurePort()The secure port of the application instance.- Specified by:
getSecurePortin interfaceConfigurableInstanceInfo- Returns:
- The secure port
-
getPortWrapper
public io.micronaut.discovery.eureka.client.v2.InstanceInfo.PortWrapper getPortWrapper()- Returns:
- The port
-
getSecurePortWrapper
public io.micronaut.discovery.eureka.client.v2.InstanceInfo.PortWrapper getSecurePortWrapper()- Returns:
- The secure port
-
setSecurePort
public void setSecurePort(int securePort) Description copied from interface:ConfigurableInstanceInfoSets the secure port of the application instance.- Specified by:
setSecurePortin interfaceConfigurableInstanceInfo- Parameters:
securePort- The secure port of the application instance
-
setPort
public void setPort(int port) Description copied from interface:ConfigurableInstanceInfoSets the port of the application instance.- Specified by:
setPortin interfaceConfigurableInstanceInfo- Parameters:
port- The port of the application instance
-
getApp
The application name.- Specified by:
getAppin interfaceConfigurableInstanceInfo- Returns:
- The application name
-
getAppGroupName
The application group name.- Specified by:
getAppGroupNamein interfaceConfigurableInstanceInfo- Returns:
- The application group name
-
getInstanceId
The instance id.- Specified by:
getInstanceIdin interfaceConfigurableInstanceInfo- Returns:
- The instance id
-
getCountryId
@Min(1L) public @jakarta.validation.constraints.Min(1L) int getCountryId()The country id.- Specified by:
getCountryIdin interfaceConfigurableInstanceInfo- Returns:
- The country id
-
getIpAddr
The IP address of the instance.- Specified by:
getIpAddrin interfaceConfigurableInstanceInfo- Returns:
- The IP address
-
getStatus
- Specified by:
getStatusin interfaceConfigurableInstanceInfo- Returns:
- The application status
-
getDataCenterInfo
TheDataCenterInfoinstance.- Specified by:
getDataCenterInfoin interfaceConfigurableInstanceInfo- Returns:
- The data center info
-
getLeaseInfo
TheLeaseInfoinstance.- Specified by:
getLeaseInfoin interfaceConfigurableInstanceInfo- Returns:
- The lease info
-
getMetadata
- Specified by:
getMetadatain interfaceConfigurableInstanceInfo- Returns:
- The instance metadata.
-
getStatusPageUrl
- Specified by:
getStatusPageUrlin interfaceConfigurableInstanceInfo- Returns:
- The status page URL
-
getHomePageUrl
- Specified by:
getHomePageUrlin interfaceConfigurableInstanceInfo- Returns:
- The home page URL
-
getHealthCheckUrl
- Specified by:
getHealthCheckUrlin interfaceConfigurableInstanceInfo- Returns:
- The health check URL
-
getVipAddress
- Specified by:
getVipAddressin interfaceConfigurableInstanceInfo- Returns:
- The Virtual Host Address for this instance (defaults to the app name)
-
getSecureVipAddress
- Specified by:
getSecureVipAddressin interfaceConfigurableInstanceInfo- Returns:
- The Secure Virtual Host Address for this instance (defaults to the app name)
-
getSecureHealthCheckUrl
- Specified by:
getSecureHealthCheckUrlin interfaceConfigurableInstanceInfo- Returns:
- The secure health check URL
-
getAsgName
- Specified by:
getAsgNamein interfaceConfigurableInstanceInfo- Returns:
- The amazon auto scaling group name
-
setInstanceId
Sets the instance ID.- Specified by:
setInstanceIdin interfaceConfigurableInstanceInfo- Parameters:
instanceId- The instance ID
-
setAsgName
Description copied from interface:ConfigurableInstanceInfoSets the Amazon auto scaling group name to use.- Specified by:
setAsgNamein interfaceConfigurableInstanceInfo- Parameters:
asgName- The Amazon auto scaling group name to use
-
setHomePageUrl
Description copied from interface:ConfigurableInstanceInfoSets the home page URL.- Specified by:
setHomePageUrlin interfaceConfigurableInstanceInfo- Parameters:
homePageUrl- The home page URL
-
setLeaseInfo
Description copied from interface:ConfigurableInstanceInfoSets theLeaseInfo.- Specified by:
setLeaseInfoin interfaceConfigurableInstanceInfo- Parameters:
leaseInfo- TheLeaseInfo
-
setCountryId
public void setCountryId(int countryId) Description copied from interface:ConfigurableInstanceInfoSets the country id.- Specified by:
setCountryIdin interfaceConfigurableInstanceInfo- Parameters:
countryId- The country id
-
setStatusPageUrl
Description copied from interface:ConfigurableInstanceInfoSets the status page URL.- Specified by:
setStatusPageUrlin interfaceConfigurableInstanceInfo- Parameters:
statusPageUrl- The status page URL
-
setHealthCheckUrl
Description copied from interface:ConfigurableInstanceInfoSets the health check URL.- Specified by:
setHealthCheckUrlin interfaceConfigurableInstanceInfo- Parameters:
healthCheckUrl- The health check URL
-
setSecureHealthCheckUrl
Description copied from interface:ConfigurableInstanceInfoSets the secure health check URL.- Specified by:
setSecureHealthCheckUrlin interfaceConfigurableInstanceInfo- Parameters:
secureHealthCheckUrl- The secure health check URL
-
setDataCenterInfo
Description copied from interface:ConfigurableInstanceInfoSets theDataCenterInfo.- Specified by:
setDataCenterInfoin interfaceConfigurableInstanceInfo- Parameters:
dataCenterInfo- TheDataCenterInfo
-
setStatus
Description copied from interface:ConfigurableInstanceInfoSets the application status.- Specified by:
setStatusin interfaceConfigurableInstanceInfo- Parameters:
status- The application status
-
setAppGroupName
Description copied from interface:ConfigurableInstanceInfoSets the application group name.- Specified by:
setAppGroupNamein interfaceConfigurableInstanceInfo- Parameters:
appGroupName- The application group name
-
setIpAddr
Description copied from interface:ConfigurableInstanceInfoSets the IP address of the instance.- Specified by:
setIpAddrin interfaceConfigurableInstanceInfo- Parameters:
ipAddr- The IP address of the instance
-
setVipAddress
Description copied from interface:ConfigurableInstanceInfoSets the Virtual Host Address.- Specified by:
setVipAddressin interfaceConfigurableInstanceInfo- Parameters:
vipAddress- The Virtual Host Address
-
setSecureVipAddress
Description copied from interface:ConfigurableInstanceInfoSets the Secure Virtual Host Address.- Specified by:
setSecureVipAddressin interfaceConfigurableInstanceInfo- Parameters:
secureVipAddress- The Secure Virtual Host Address
-
setMetadata
- Parameters:
metadata- Sets the application metadata
-