private ModifyTransitGatewayOptions getTransitGatewayModifyOptions()

in aws-ec2-transitgateway/src/main/java/com/aws/ec2/transitgateway/workflow/update/Update.java [60:114]


    private ModifyTransitGatewayOptions getTransitGatewayModifyOptions(ResourceModel model){

            List<String> cidrBlocksToCreate = cidrBlocksToCreate(model);
            List<String> cidrBlocksToDelete = cidrBlocksToDelete(model);

         if((cidrBlocksToCreate == null || cidrBlocksToCreate.isEmpty()) && (cidrBlocksToDelete == null || cidrBlocksToDelete.isEmpty())) {
             return ModifyTransitGatewayOptions.builder()
                     .associationDefaultRouteTableId(model.getAssociationDefaultRouteTableId())
                     .autoAcceptSharedAttachments(model.getAutoAcceptSharedAttachments())
                     .defaultRouteTableAssociation(model.getDefaultRouteTableAssociation())
                     .vpnEcmpSupport(model.getVpnEcmpSupport())
                     .dnsSupport(model.getDnsSupport())
                     .propagationDefaultRouteTableId(model.getPropagationDefaultRouteTableId())
                     .build();
         }
         else if((cidrBlocksToCreate == null || cidrBlocksToCreate.isEmpty()) && (cidrBlocksToDelete != null || !cidrBlocksToDelete.isEmpty())) {
             logger.log("Only removing the CIDR blocks from the TransitGateway, no CIDR ranges to add");
             return ModifyTransitGatewayOptions.builder()
                     .removeTransitGatewayCidrBlocks(cidrBlocksToDelete)
                     .associationDefaultRouteTableId(model.getAssociationDefaultRouteTableId())
                     .autoAcceptSharedAttachments(model.getAutoAcceptSharedAttachments())
                     .defaultRouteTableAssociation(model.getDefaultRouteTableAssociation())
                     .vpnEcmpSupport(model.getVpnEcmpSupport())
                     .dnsSupport(model.getDnsSupport())
                     .propagationDefaultRouteTableId(model.getPropagationDefaultRouteTableId())
                     .build();
         }
         else if((cidrBlocksToCreate != null || !cidrBlocksToCreate.isEmpty()) && (cidrBlocksToDelete == null || cidrBlocksToDelete.isEmpty())) {
             logger.log("Only Adding the CIDR blocks to the TransitGateway, no CIDR ranges to remove");
             return ModifyTransitGatewayOptions.builder()
                     .addTransitGatewayCidrBlocks(cidrBlocksToCreate)
                     .associationDefaultRouteTableId(model.getAssociationDefaultRouteTableId())
                     .autoAcceptSharedAttachments(model.getAutoAcceptSharedAttachments())
                     .defaultRouteTableAssociation(model.getDefaultRouteTableAssociation())
                     .vpnEcmpSupport(model.getVpnEcmpSupport())
                     .dnsSupport(model.getDnsSupport())
                     .propagationDefaultRouteTableId(model.getPropagationDefaultRouteTableId())
                     .build();
         }
         else{
             logger.log("Adding and Removing the CIDR blocks to the TransitGateway");
             return ModifyTransitGatewayOptions.builder()
                     .addTransitGatewayCidrBlocks(cidrBlocksToCreate)
                     .removeTransitGatewayCidrBlocks(cidrBlocksToDelete)
                     .associationDefaultRouteTableId(model.getAssociationDefaultRouteTableId())
                     .autoAcceptSharedAttachments(model.getAutoAcceptSharedAttachments())
                     .defaultRouteTableAssociation(model.getDefaultRouteTableAssociation())
                     .vpnEcmpSupport(model.getVpnEcmpSupport())
                     .dnsSupport(model.getDnsSupport())
                     .propagationDefaultRouteTableId(model.getPropagationDefaultRouteTableId())
                     .build();
         }


    }