<commit_before>module XYZ
  class TargetController < AuthController
    helper :target_helper

    PROVIDER_PREFIX = 'provider'

    def rest__list()

      subtype = ret_target_subtype()

      if subtype.eql? :instance
        response = Target::Instance.list(model_handle())
      else
        response = Target::Template.list(model_handle())
      end

      rest_ok_response response
    end


    def rest__full_list()
      # templates and instances
      targets = Target::Instance.full_list(model_handle())

      # add provider prefix to results
      results = targets.collect do |entry|
        if (entry[:type] == 'template')
          entry[:display_name] = "#{PROVIDER_PREFIX}::#{entry[:display_name]}"
          entry
        else
          entry
        end
      end

      rest_ok_response results
    end

    def rest__create()
      display_name = ret_non_null_request_params(:target_name)
      template_id  = ret_request_params(:target_template_id)
      params_hash  = ret_params_hash(:description,:iaas_type,:iaas_properties)
      is_no_bootstrap  = ret_request_param_boolean(:no_bootstrap)

      project_idh  = get_default_project().id_handle()


      unless template_id
        # we first check if we are ok with aws credentials
        params_hash[:iaas_properties] = CommandAndControl.prepare_account_for_target(params_hash[:iaas_type].to_s,params_hash[:iaas_properties])
        # create target template
        target_idh = Target::Template.create_from_user_input(project_idh, display_name, params_hash, true)
        # get object since we will need iaas data to copy
        target_template =  Model.get_objs(target_idh, { :cols => [:id, :description, :iaas_type, :iaas_properties]}).first
        template_id = target_template[:id]
      else<commit_msg>Fixed rebase<commit_after>module XYZ
  class TargetController < AuthController
    helper :target_helper

    PROVIDER_PREFIX = 'provider'

    def rest__list()

      subtype = ret_target_subtype()

      if subtype.eql? :instance
        response = Target::Instance.list(model_handle())
      else
        response = Target::Template.list(model_handle())
      end

      rest_ok_response response
    end


    def rest__full_list()
      # templates and instances
      targets = Target::Instance.full_list(model_handle())

      # add provider prefix to results
      results = targets.collect do |entry|
        if (entry[:type] == 'template')
          entry[:display_name] = "#{PROVIDER_PREFIX}::#{entry[:display_name]}"
          entry
        else
          entry
        end
      end

      rest_ok_response results
    end

    def rest__create()
      display_name = ret_non_null_request_params(:target_name)
      template_id  = ret_request_params(:target_template_id)
      params_hash  = ret_params_hash(:description,:iaas_type,:iaas_properties)
      is_no_bootstrap  = ret_request_param_boolean(:no_bootstrap)

      project_idh  = get_default_project().id_handle()


      unless template_id
        # we first check if we are ok with aws credentials
        params_hash[:iaas_properties] = CommandAndControl.prepare_account_for_target(params_hash[:iaas_type].to_s,params_hash[:iaas_properties])

        # create target template
        target_idh = Target::Template.create_from_user_input(project_idh, display_name, params_hash, true)
        # get object since we will need iaas data to copy
        target_template =  Model.get_objs(target_idh, { :cols => [:id, :description, :iaas_type, :iaas_properties]}).first
        template_id = target_template[:id]
      else
{'fraction_non_alphanumeric': 0.08542713567839195, 'fraction_numerical': 0.0, 'mean_word_length': 3.200468933177022, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2953645', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1038, 'n_words': 216}