in src/main/java/com/amazonaws/fixengineonaws/FixEngineConfig.java [139:193]
private String getSsmParameter(String parameterName) {
LOGGER.info("FIXENGINECONFIG **********GET SSM PARAMETER looking up parameterPath/parameterName: " + parameterPath + "/" + parameterName + " using SSM_CLIENT: " + SSM_CLIENT);
if(System.getProperty("os.name").contains("Windows")) {
LOGGER.info("FIXENGINECONFIG GET SSM PARAMETER PATH returning dummy value because we're running on Windows not Unix");
// return new HashMap<String, String>();
if("GLOBAL_ACCELERATOR_ENDPOINT_ARN".equals(parameterName)) {
return "arn:aws:elasticloadbalancing:us-east-1:XXXXXXXXXXXX:loadbalancer/net/FixEn-Prima-XXXXXXXXXXXX/XXXXXXXXXXXXXXXX";
}
// update arn with account number- replace XXXXXXXXXXXX with numbers
HashMap<String, String> ret = new HashMap<String, String>();
ret.put("SenderCompID","client");
ret.put("ConnectionType","initiator");
ret.put("PrimaryMSKEndpoint","b-1.fixengineonaws-client.pupo46.c6.kafka.us-east-1.amazonaws.com");
ret.put("KafkaConnTLS","false");
ret.put("TargetCompID","server");
ret.put("KafkaPort","9092");
ret.put("DebugLogging","true");
ret.put("FIXServerPort","9877");
ret.put("FailoverMSKEndpoint","b-2.fixengineonaws-client.pupo46.c6.kafka.us-east-1.amazonaws.com");
ret.put("FIXServerDNSName","XXXXXXXXXXXXXXXXX.awsglobalaccelerator.com");
ret.put("ApplicationID","client");
ret.put("RDSClusterSecretArn","arn:aws:secretsmanager:us-east-1:XXXXXXXXXXXX:secret:RDSClusterAdminSecret-XXXXXXXXXXXX-XXXXXX");
ret.put("RDSClusterNonAdminSecretArn","arn:aws:secretsmanager:us-east-1:XXXXXXXXXXXX:secret:RDSClusterNonAdminSecret-XXXXXXXXXXXX-XXXXXX");
ret.put("GlobalAcceleratorEndpointGroupArn", "arn:aws:elasticloadbalancing:us-east-1:XXXXXXXXXXXX:loadbalancer/net/FixEn-Failo-XXXXXXXXXXXX/XXXXXXXXXXXXXXXX");
return(ret.get(parameterName));
}
if("GLOBAL_ACCELERATOR_ENDPOINT_ARN".equals(parameterName)) {
String GAEndpointArn = System.getenv(parameterName);
LOGGER.fine("FIXENGINECONFIG GET SSM PARAMETER PATH got GA endpoint env var : [" + parameterName + "] value [" + GAEndpointArn + "]");
if(GAEndpointArn == null) {
LOGGER.severe("FIXENGINECONFIG GET SSM PARAMETER unable to find System Environment Variable (that should contain the CloudFormation stack name that created all SSM parameters) called: " + parameterName);
}
return GAEndpointArn;
}
if(SSM_CLIENT == null) {
LOGGER.info("FIXENGINECONFIG SSM_CLIENT is null, so creating it now...");
SSM_CLIENT = AWSSimpleSystemsManagementClientBuilder.standard().build();
if(SSM_CLIENT == null) {
LOGGER.severe("FIXENGINECONFIG GET SSM PARAMETER unable to create an AWSSimpleSystemsManagementClientBuilder! Check IAM privileges to see if your process has enough access to read params!");
}
}
String key = parameterPath + "/" + parameterName;
try {
GetParameterRequest parametersRequest = new GetParameterRequest().withName(key).withWithDecryption(false);
GetParameterResult parameterResult = SSM_CLIENT.getParameter(parametersRequest);
String value = parameterResult.getParameter().getValue();
LOGGER.fine("FIXENGINECONFIG GET SSM PARAMETER got key : [" + key + "] value [" + value + "]");
return value;
} catch (Exception e) {
LOGGER.fine("FIXENGINECONFIG GET SSM PARAMETER unable to get key : [" + key + "] : " + e);
throw e;
}
}