Java Code Examples for com.netflix.appinfo.DataCenterInfo#getName()

The following examples show how to use com.netflix.appinfo.DataCenterInfo#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EurekaController.java    From didi-eureka-server with MIT License 6 votes vote down vote up
private void populateHeader(Map<String, Object> model) {
	model.put("currentTime", StatusResource.getCurrentTimeAsString());
	model.put("upTime", StatusInfo.getUpTime());
	model.put("environment", ConfigurationManager.getDeploymentContext()
			.getDeploymentEnvironment());
	model.put("datacenter", ConfigurationManager.getDeploymentContext()
			.getDeploymentDatacenter());
	PeerAwareInstanceRegistry registry = getRegistry();
	model.put("registry", registry);
	model.put("isBelowRenewThresold", registry.isBelowRenewThresold() == 1);
	DataCenterInfo info = applicationInfoManager.getInfo().getDataCenterInfo();
	if (info.getName() == DataCenterInfo.Name.Amazon) {
		AmazonInfo amazonInfo = (AmazonInfo) info;
		model.put("amazonInfo", amazonInfo);
		model.put("amiId", amazonInfo.get(AmazonInfo.MetaDataKey.amiId));
		model.put("availabilityZone",
				amazonInfo.get(AmazonInfo.MetaDataKey.availabilityZone));
		model.put("instanceId", amazonInfo.get(AmazonInfo.MetaDataKey.instanceId));
	}
}
 
Example 2
Source File: EurekaController.java    From spring-cloud-netflix with Apache License 2.0 6 votes vote down vote up
private void populateHeader(Map<String, Object> model) {
	model.put("currentTime", StatusResource.getCurrentTimeAsString());
	model.put("upTime", StatusInfo.getUpTime());
	model.put("environment", "N/A"); // FIXME:
	model.put("datacenter", "N/A"); // FIXME:
	PeerAwareInstanceRegistry registry = getRegistry();
	model.put("registry", registry);
	model.put("isBelowRenewThresold", registry.isBelowRenewThresold() == 1);
	DataCenterInfo info = applicationInfoManager.getInfo().getDataCenterInfo();
	if (info.getName() == DataCenterInfo.Name.Amazon) {
		AmazonInfo amazonInfo = (AmazonInfo) info;
		model.put("amazonInfo", amazonInfo);
		model.put("amiId", amazonInfo.get(AmazonInfo.MetaDataKey.amiId));
		model.put("availabilityZone",
				amazonInfo.get(AmazonInfo.MetaDataKey.availabilityZone));
		model.put("instanceId", amazonInfo.get(AmazonInfo.MetaDataKey.instanceId));
	}
}
 
Example 3
Source File: ArmeriaEurekaClientTest.java    From armeria with Apache License 2.0 5 votes vote down vote up
private static com.linecorp.armeria.internal.common.eureka.DataCenterInfo convertDataCenterInfo(
        DataCenterInfo dataCenterInfo) {
    final Map<String, String> metadata;
    if (dataCenterInfo.getName() == Name.Amazon) {
        metadata = ((AmazonInfo) dataCenterInfo).getMetadata();
    } else {
        metadata = ImmutableMap.of();
    }
    return new com.linecorp.armeria.internal.common.eureka.DataCenterInfo(
            dataCenterInfo.getName().name(), metadata);
}