private boolean stabilizedOnCreate()

in aws-sagemaker-app/src/main/java/software/amazon/sagemaker/app/CreateHandler.java [84:119]


    private boolean stabilizedOnCreate(
            final CreateAppRequest awsRequest,
            final CreateAppResponse awsResponse,
            final ProxyClient<SageMakerClient> proxyClient,
            final ResourceModel model,
            final CallbackContext callbackContext) {

        if (model.getAppName() == null) {
            model.setAppName(awsRequest.appName());
        }

        final AppStatus AppStatus;
        try {
            AppStatus = proxyClient.injectCredentialsAndInvokeV2(
                    TranslatorForRequest.translateToReadRequest(model),
                    proxyClient.client()::describeApp).status();
        } catch (ResourceNotFoundException rnfe) {
            logger.log(String.format("Resource not found for %s, stabilizing.", model.getPrimaryIdentifier()));
            return false;
        }

        switch (AppStatus) {
            case IN_SERVICE:
                logger.log(String.format("%s [%s] has been stabilized with status %s.", ResourceModel.TYPE_NAME,
                        model.getPrimaryIdentifier(), AppStatus));
                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(), AppStatus));
                throw new CfnNotStabilizedException(ResourceModel.TYPE_NAME, model.getAppName());
        }
    }