<commit_before>
require "/opt/engos/lib/ruby/ManagedContainer.rb"
require "/opt/engos/lib/ruby/SysConfig.rb"
require "/opt/engos/lib/ruby/ManagedEngine.rb"
require "/opt/engos/lib/ruby/ManagedService.rb"
require "/opt/engos/lib/ruby/NginxService.rb"
require "/opt/engos/lib/ruby/NagiosService.rb"

class EnginesOSapi
  def initialize()
      
  end
    
#At this stage just wrappers

  def getManagedEngines
    return ManagedEngine.getManagedEngines()
  end
  
  def loadManagedEngine container_name
    engine = ManagedEngine.load(container_name)
    if engine == nil
      return false
    end
    return engine
  end
  
 
   
   def stopEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false   
     end  
     return engine.stop_container     
   end
   
   def startEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false    
     end
     return engine.start_container
   end
   
   def pauseEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end    
     return engine.pause_container     
   end
   
   def unpauseEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
     return engine.unpause_container
   end
  
    def destroyEngine container_name
      engine = loadManagedEngine container_name
      if engine == nil
        return false
      end
      return engine.destroy_container
    end
    
   def deleteEngineImage container_name 
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
    return engine.delete_container
   end
    
   def createEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
    return engine.create_container
   end
   
   def restartEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
     return engine.restart_container
   end
  
   def registerEngineWebSite container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
     return  engine.register_site
   end
   
   def deregisterEngineWebSite container_name
     engine = loadManagedEngine container_name
       if engine == nil
        return false
       end
    return engine.unregister_site 
   end
   
   def monitorEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
     return engine.monitor_site   
   end
   
   def demonitorEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end         
     return engine.demonitor_site
   end
   
   
  def getManagedServices
      return ManagedService.getManagedEngines()
    end
    
    def loadManagedService container_name
      return ManagedService.load(container_name)
    end
    
    def stopService container_name
      service = ManagedService.load(container_name)
      if service == nill<commit_msg>services not engines<commit_after>
require "/opt/engos/lib/ruby/ManagedContainer.rb"
require "/opt/engos/lib/ruby/SysConfig.rb"
require "/opt/engos/lib/ruby/ManagedEngine.rb"
require "/opt/engos/lib/ruby/ManagedService.rb"
require "/opt/engos/lib/ruby/NginxService.rb"
require "/opt/engos/lib/ruby/NagiosService.rb"

class EnginesOSapi
  def initialize()
      
  end
    
#At this stage just wrappers

  def getManagedEngines
    return ManagedEngine.getManagedEngines()
  end
  
  def loadManagedEngine container_name
    engine = ManagedEngine.load(container_name)
    if engine == nil
      return false
    end
    return engine
  end
  
 
   
   def stopEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false   
     end  
     return engine.stop_container     
   end
   
   def startEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false    
     end
     return engine.start_container
   end
   
   def pauseEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end    
     return engine.pause_container     
   end
   
   def unpauseEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
     return engine.unpause_container
   end
  
    def destroyEngine container_name
      engine = loadManagedEngine container_name
      if engine == nil
        return false
      end
      return engine.destroy_container
    end
    
   def deleteEngineImage container_name 
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
    return engine.delete_container
   end
    
   def createEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
    return engine.create_container
   end
   
   def restartEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
     return engine.restart_container
   end
  
   def registerEngineWebSite container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
     return  engine.register_site
   end
   
   def deregisterEngineWebSite container_name
     engine = loadManagedEngine container_name
       if engine == nil
        return false
       end
    return engine.unregister_site 
   end
   
   def monitorEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end
     return engine.monitor_site   
   end
   
   def demonitorEngine container_name
     engine = loadManagedEngine container_name
     if engine == nil
       return false
     end         
     return engine.demonitor_site
   end
   
   
  def getManagedServices
      return ManagedService.getManagedServices()
    end
    
    def loadManagedService container_name
      return ManagedService.load(container_name)
    end
    
    def stopService container_name
      service = ManagedService.load(container_name)
      if service == nill
{'fraction_non_alphanumeric': 0.03874015748031496, 'fraction_numerical': 0.0, 'mean_word_length': 2.401713979646492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4183974', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1685, 'n_words': 483}