in aws-sagemaker-userprofile/src/main/java/software/amazon/sagemaker/userprofile/CreateHandler.java [84:123]
private boolean stabilizedOnCreate(
final CreateUserProfileRequest awsRequest,
final CreateUserProfileResponse awsResponse,
final ProxyClient<SageMakerClient> proxyClient,
final ResourceModel model,
final CallbackContext callbackContext) {
if (model.getUserProfileName() == null) {
model.setUserProfileName(awsRequest.userProfileName());
}
if (model.getDomainId() == null) {
model.setDomainId(awsRequest.domainId());
}
final UserProfileStatus UserProfileStatus;
try {
UserProfileStatus = proxyClient.injectCredentialsAndInvokeV2(
TranslatorForRequest.translateToReadRequest(model),
proxyClient.client()::describeUserProfile).status();
} catch (ResourceNotFoundException rnfe) {
logger.log(String.format("Resource not found for %s, stabilizing.", model.getPrimaryIdentifier()));
return false;
}
switch (UserProfileStatus) {
case IN_SERVICE:
logger.log(String.format("%s [%s] has been stabilized with status %s.", ResourceModel.TYPE_NAME,
model.getPrimaryIdentifier(), UserProfileStatus));
return true;
case PENDING:
logger.log(String.format("%s [%s] is stabilizing.", ResourceModel.TYPE_NAME,
model.getPrimaryIdentifier()));
return false;
default:
logger.log(String.format("%s [%s] failed to stabilize with status: %s.", ResourceModel.TYPE_NAME,
model.getPrimaryIdentifier(), UserProfileStatus));
throw new CfnNotStabilizedException(ResourceModel.TYPE_NAME, model.getUserProfileName());
}
}