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
Modifier and TypeClassDescriptionstatic enum
The instance status according to Eureka. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
US by default.static final int
Eureka default port.static final int
Secure port disabled by default. -
Constructor Summary
ConstructorDescriptionInstanceInfo
(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 String
getApp()
The application name.The application group name.@jakarta.validation.constraints.Min(1L) int
The country id.@NotNull DataCenterInfo
TheDataCenterInfo
instance.@NotBlank String
The host name of the application instance.getId()
Returns the unique id of the instance.@NotBlank String
The instance id.@NotBlank String
The IP address of the instance.TheLeaseInfo
instance.int
getPort()
The port of the application instance.io.micronaut.discovery.eureka.client.v2.InstanceInfo.PortWrapper
int
The secure port of the application instance.io.micronaut.discovery.eureka.client.v2.InstanceInfo.PortWrapper
@NotBlank String
@NotNull InstanceInfo.Status
@NotBlank String
void
setAppGroupName
(String appGroupName) Sets the application group name.void
setAsgName
(String asgName) Sets the Amazon auto scaling group name to use.void
setCountryId
(int countryId) Sets the country id.void
setDataCenterInfo
(DataCenterInfo dataCenterInfo) Sets theDataCenterInfo
.void
setHealthCheckUrl
(String healthCheckUrl) Sets the health check URL.void
setHomePageUrl
(String homePageUrl) Sets the home page URL.void
setInstanceId
(String instanceId) Sets the instance ID.void
Sets the IP address of the instance.void
setLeaseInfo
(LeaseInfo leaseInfo) Sets theLeaseInfo
.void
setMetadata
(Map<String, String> metadata) void
setPort
(int port) Sets the port of the application instance.void
setSecureHealthCheckUrl
(String secureHealthCheckUrl) Sets the secure health check URL.void
setSecurePort
(int securePort) Sets the secure port of the application instance.void
setSecureVipAddress
(String secureVipAddress) Sets the Secure Virtual Host Address.void
setStatus
(InstanceInfo.Status status) Sets the application status.void
setStatusPageUrl
(String statusPageUrl) Sets the status page URL.void
setVipAddress
(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:
getHostName
in 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:
getId
in interfaceConfigurableInstanceInfo
- Returns:
- the unique id.
-
getPort
public int getPort()The port of the application instance.- Specified by:
getPort
in interfaceConfigurableInstanceInfo
- Returns:
- The port
-
getSecurePort
public int getSecurePort()The secure port of the application instance.- Specified by:
getSecurePort
in 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:ConfigurableInstanceInfo
Sets the secure port of the application instance.- Specified by:
setSecurePort
in interfaceConfigurableInstanceInfo
- Parameters:
securePort
- The secure port of the application instance
-
setPort
public void setPort(int port) Description copied from interface:ConfigurableInstanceInfo
Sets the port of the application instance.- Specified by:
setPort
in interfaceConfigurableInstanceInfo
- Parameters:
port
- The port of the application instance
-
getApp
The application name.- Specified by:
getApp
in interfaceConfigurableInstanceInfo
- Returns:
- The application name
-
getAppGroupName
The application group name.- Specified by:
getAppGroupName
in interfaceConfigurableInstanceInfo
- Returns:
- The application group name
-
getInstanceId
The instance id.- Specified by:
getInstanceId
in interfaceConfigurableInstanceInfo
- Returns:
- The instance id
-
getCountryId
@Min(1L) public @jakarta.validation.constraints.Min(1L) int getCountryId()The country id.- Specified by:
getCountryId
in interfaceConfigurableInstanceInfo
- Returns:
- The country id
-
getIpAddr
The IP address of the instance.- Specified by:
getIpAddr
in interfaceConfigurableInstanceInfo
- Returns:
- The IP address
-
getStatus
- Specified by:
getStatus
in interfaceConfigurableInstanceInfo
- Returns:
- The application status
-
getDataCenterInfo
TheDataCenterInfo
instance.- Specified by:
getDataCenterInfo
in interfaceConfigurableInstanceInfo
- Returns:
- The data center info
-
getLeaseInfo
TheLeaseInfo
instance.- Specified by:
getLeaseInfo
in interfaceConfigurableInstanceInfo
- Returns:
- The lease info
-
getMetadata
- Specified by:
getMetadata
in interfaceConfigurableInstanceInfo
- Returns:
- The instance metadata.
-
getStatusPageUrl
- Specified by:
getStatusPageUrl
in interfaceConfigurableInstanceInfo
- Returns:
- The status page URL
-
getHomePageUrl
- Specified by:
getHomePageUrl
in interfaceConfigurableInstanceInfo
- Returns:
- The home page URL
-
getHealthCheckUrl
- Specified by:
getHealthCheckUrl
in interfaceConfigurableInstanceInfo
- Returns:
- The health check URL
-
getVipAddress
- Specified by:
getVipAddress
in interfaceConfigurableInstanceInfo
- Returns:
- The Virtual Host Address for this instance (defaults to the app name)
-
getSecureVipAddress
- Specified by:
getSecureVipAddress
in interfaceConfigurableInstanceInfo
- Returns:
- The Secure Virtual Host Address for this instance (defaults to the app name)
-
getSecureHealthCheckUrl
- Specified by:
getSecureHealthCheckUrl
in interfaceConfigurableInstanceInfo
- Returns:
- The secure health check URL
-
getAsgName
- Specified by:
getAsgName
in interfaceConfigurableInstanceInfo
- Returns:
- The amazon auto scaling group name
-
setInstanceId
Sets the instance ID.- Specified by:
setInstanceId
in interfaceConfigurableInstanceInfo
- Parameters:
instanceId
- The instance ID
-
setAsgName
Description copied from interface:ConfigurableInstanceInfo
Sets the Amazon auto scaling group name to use.- Specified by:
setAsgName
in interfaceConfigurableInstanceInfo
- Parameters:
asgName
- The Amazon auto scaling group name to use
-
setHomePageUrl
Description copied from interface:ConfigurableInstanceInfo
Sets the home page URL.- Specified by:
setHomePageUrl
in interfaceConfigurableInstanceInfo
- Parameters:
homePageUrl
- The home page URL
-
setLeaseInfo
Description copied from interface:ConfigurableInstanceInfo
Sets theLeaseInfo
.- Specified by:
setLeaseInfo
in interfaceConfigurableInstanceInfo
- Parameters:
leaseInfo
- TheLeaseInfo
-
setCountryId
public void setCountryId(int countryId) Description copied from interface:ConfigurableInstanceInfo
Sets the country id.- Specified by:
setCountryId
in interfaceConfigurableInstanceInfo
- Parameters:
countryId
- The country id
-
setStatusPageUrl
Description copied from interface:ConfigurableInstanceInfo
Sets the status page URL.- Specified by:
setStatusPageUrl
in interfaceConfigurableInstanceInfo
- Parameters:
statusPageUrl
- The status page URL
-
setHealthCheckUrl
Description copied from interface:ConfigurableInstanceInfo
Sets the health check URL.- Specified by:
setHealthCheckUrl
in interfaceConfigurableInstanceInfo
- Parameters:
healthCheckUrl
- The health check URL
-
setSecureHealthCheckUrl
Description copied from interface:ConfigurableInstanceInfo
Sets the secure health check URL.- Specified by:
setSecureHealthCheckUrl
in interfaceConfigurableInstanceInfo
- Parameters:
secureHealthCheckUrl
- The secure health check URL
-
setDataCenterInfo
Description copied from interface:ConfigurableInstanceInfo
Sets theDataCenterInfo
.- Specified by:
setDataCenterInfo
in interfaceConfigurableInstanceInfo
- Parameters:
dataCenterInfo
- TheDataCenterInfo
-
setStatus
Description copied from interface:ConfigurableInstanceInfo
Sets the application status.- Specified by:
setStatus
in interfaceConfigurableInstanceInfo
- Parameters:
status
- The application status
-
setAppGroupName
Description copied from interface:ConfigurableInstanceInfo
Sets the application group name.- Specified by:
setAppGroupName
in interfaceConfigurableInstanceInfo
- Parameters:
appGroupName
- The application group name
-
setIpAddr
Description copied from interface:ConfigurableInstanceInfo
Sets the IP address of the instance.- Specified by:
setIpAddr
in interfaceConfigurableInstanceInfo
- Parameters:
ipAddr
- The IP address of the instance
-
setVipAddress
Description copied from interface:ConfigurableInstanceInfo
Sets the Virtual Host Address.- Specified by:
setVipAddress
in interfaceConfigurableInstanceInfo
- Parameters:
vipAddress
- The Virtual Host Address
-
setSecureVipAddress
Description copied from interface:ConfigurableInstanceInfo
Sets the Secure Virtual Host Address.- Specified by:
setSecureVipAddress
in interfaceConfigurableInstanceInfo
- Parameters:
secureVipAddress
- The Secure Virtual Host Address
-
setMetadata
- Parameters:
metadata
- Sets the application metadata
-