in aws-sagemaker-project/src/main/java/software/amazon/sagemaker/project/CreateHandler.java [79:113]
private boolean stabilizedOnCreate(
final CreateProjectRequest createRequest,
final CreateProjectResponse createResponse,
final ProxyClient<SageMakerClient> proxyClient,
final ResourceModel model,
final CallbackContext callbackContext) {
if(model.getProjectArn() == null){
model.setProjectArn(createResponse.projectArn());
}
final DescribeProjectResponse response = proxyClient.injectCredentialsAndInvokeV2(Translator.translateToReadRequest(model),
proxyClient.client()::describeProject);
final ProjectStatus projectStatus = response.projectStatus();
switch (projectStatus) {
case CREATE_COMPLETED:
case CREATE_FAILED:
case DELETE_FAILED:
logger.log(String.format("%s [%s] has been stabilized with status %s.", ResourceModel.TYPE_NAME,
model.getPrimaryIdentifier(), projectStatus));
return true;
case PENDING:
case CREATE_IN_PROGRESS:
case DELETE_IN_PROGRESS:
logger.log(String.format("%s [%s] is stabilizing.", ResourceModel.TYPE_NAME, model.getPrimaryIdentifier()));
return false;
default:
throw new CfnGeneralServiceException(
"Stabilizing of " + model.getPrimaryIdentifier()
+ " failed with unexpected status " + projectStatus);
}
}