in aws-route53recoverycontrol-cluster/src/main/java/software/amazon/route53recoverycontrol/cluster/CreateHandler.java [64:100]
private boolean isStabilized(
CreateClusterRequest createRequest,
CreateClusterResponse createResponse,
ProxyClient<Route53RecoveryControlConfigClient> proxyClient,
ResourceModel model,
CallbackContext context
) {
if (createResponse.cluster().clusterArn() == null) {
logger.log(String.format("%s has not yet stabilized. Cluster arn is null", ResourceModel.TYPE_NAME));
return false;
}
String clusterArn = createResponse.cluster().clusterArn();
model.setClusterArn(clusterArn);
DescribeClusterResponse describeResponse;
try{
describeResponse = describeCluster(DescribeClusterRequest.builder().clusterArn(clusterArn).build(), proxyClient);
logger.log(String.format("Describe Response %s", describeResponse));
} catch (CfnNotFoundException e) {
logger.log(String.format("%s has not yet stabilized.", ResourceModel.TYPE_NAME));
return false;
}
if (describeResponse.cluster().hasClusterEndpoints()) {
if (describeResponse.cluster().statusAsString().equals("DEPLOYED") ||
describeResponse.cluster().statusAsString().equals("PENDING")) {
logger.log(String.format("%s has stabilized.", ResourceModel.TYPE_NAME));
return true;
}
}
logger.log(String.format("%s has not yet stabilized.", ResourceModel.TYPE_NAME));
return false;
}