aws-ec2-transitgatewayconnect/src/main/java/software/amazon/ec2/transitgatewayconnect/workflow/update/ValidPropertiesCheck.java [18:82]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class ValidPropertiesCheck {
    AmazonWebServicesClientProxy proxy;
    ResourceHandlerRequest<ResourceModel> request;
    CallbackContext callbackContext;
    ProxyClient<Ec2Client> client;
    Logger logger;
    JSONObject _config;

    public ValidPropertiesCheck(
        AmazonWebServicesClientProxy proxy,
        ResourceHandlerRequest<ResourceModel> request,
        CallbackContext callbackContext,
        ProxyClient<Ec2Client> client,
        Logger logger
    ) {
        this.proxy = proxy;
        this.request = request;
        this.callbackContext = callbackContext;
        this.client = client;
        this.logger = logger;
    }

    public ProgressEvent<ResourceModel, CallbackContext>  run(ProgressEvent<ResourceModel, CallbackContext> progress) {
        if(this.request.getDesiredResourceState().getTransitGatewayAttachmentId() == null) {
            CfnInvalidRequestException exception =  new CfnInvalidRequestException( this.getConfig().getJSONArray("primaryIdentifier").getString(0).replace("/properties/", "") + " cannot be NULL.");
            return ProgressEvent.defaultFailureHandler(exception, HandlerErrorCode.InvalidRequest);
        }
        else if(this.invalidProperties().isEmpty()) {
            return progress;
        } else {
            CfnInvalidRequestException exception =  new CfnInvalidRequestException(this.invalidProperties().toString() + ": cannot be changed and can only be used to create " + ResourceModel.TYPE_NAME + ".");
            return ProgressEvent.defaultFailureHandler(exception, HandlerErrorCode.InvalidRequest);
        }
    }

    private JSONObject getConfig() {
        if(this._config == null) {
            return this._config = new Configuration().resourceSchemaJSONObject();
        } else {
            return this._config;
        }
    }

    private List<String> createOnlyProperties() {
        //PULL CREATE ONLY PROPERTIES FROM THE JSON SCHEMA TO SEE IF THERE ARE ANY DEFINED IN THE REQUEST THAT SHOULD NOT BE

        if(this.getConfig().has("createOnlyProperties")) {
            JSONArray props = this.getConfig().getJSONArray("createOnlyProperties");
            List<String> list = new ArrayList<>();
            for(int i = 0; i < props.length(); i++){
                String prop = props.getString(i).replace("/properties/", "");
                list.add(prop);
            }
            return list;
        } else {
            return new ArrayList<>();
        }
    }

    private List<String> invalidProperties() {
        ResourceModel model = this.request.getDesiredResourceState();
        ResourceModel previousModel = this.request.getPreviousResourceState();
        return this.createOnlyProperties().stream().filter((prop) -> {
            try {
                Method method = model.getClass().getMethod("get" + prop);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



aws-ec2-transitgatewaypeeringattachment/src/main/java/software/amazon/ec2/transitgatewaypeeringattachment/workflow/update/ValidPropertiesCheck.java [18:82]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class ValidPropertiesCheck {
    AmazonWebServicesClientProxy proxy;
    ResourceHandlerRequest<ResourceModel> request;
    CallbackContext callbackContext;
    ProxyClient<Ec2Client> client;
    Logger logger;
    JSONObject _config;

    public ValidPropertiesCheck(
        AmazonWebServicesClientProxy proxy,
        ResourceHandlerRequest<ResourceModel> request,
        CallbackContext callbackContext,
        ProxyClient<Ec2Client> client,
        Logger logger
    ) {
        this.proxy = proxy;
        this.request = request;
        this.callbackContext = callbackContext;
        this.client = client;
        this.logger = logger;
    }

    public ProgressEvent<ResourceModel, CallbackContext>  run(ProgressEvent<ResourceModel, CallbackContext> progress) {
        if(this.request.getDesiredResourceState().getTransitGatewayAttachmentId() == null) {
            CfnInvalidRequestException exception =  new CfnInvalidRequestException( this.getConfig().getJSONArray("primaryIdentifier").getString(0).replace("/properties/", "") + " cannot be NULL.");
            return ProgressEvent.defaultFailureHandler(exception, HandlerErrorCode.InvalidRequest);
        }
        else if(this.invalidProperties().isEmpty()) {
            return progress;
        } else {
            CfnInvalidRequestException exception =  new CfnInvalidRequestException(this.invalidProperties().toString() + ": cannot be changed and can only be used to create " + ResourceModel.TYPE_NAME + ".");
            return ProgressEvent.defaultFailureHandler(exception, HandlerErrorCode.InvalidRequest);
        }
    }

    private JSONObject getConfig() {
        if(this._config == null) {
            return this._config = new Configuration().resourceSchemaJSONObject();
        } else {
            return this._config;
        }
    }

    private List<String> createOnlyProperties() {
        //PULL CREATE ONLY PROPERTIES FROM THE JSON SCHEMA TO SEE IF THERE ARE ANY DEFINED IN THE REQUEST THAT SHOULD NOT BE

        if(this.getConfig().has("createOnlyProperties")) {
            JSONArray props = this.getConfig().getJSONArray("createOnlyProperties");
            List<String> list = new ArrayList<>();
            for(int i = 0; i < props.length(); i++){
                String prop = props.getString(i).replace("/properties/", "");
                list.add(prop);
            }
            return list;
        } else {
            return new ArrayList<>();
        }
    }

    private List<String> invalidProperties() {
        ResourceModel model = this.request.getDesiredResourceState();
        ResourceModel previousModel = this.request.getPreviousResourceState();
        return this.createOnlyProperties().stream().filter((prop) -> {
            try {
                Method method = model.getClass().getMethod("get" + prop);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



