lib/gooddata/models/schedule.rb
def create(process_id, trigger, executable, options = {})
        c, project = GoodData.get_client_and_project(options)

        fail 'Process ID has to be provided' if process_id.blank?

        is_dataload_process = Process[process_id, project: project, client: c].type == :dataload

        if is_dataload_process
          dataload_datasets = options[:dataload_datasets] || options['GDC_DATALOAD_DATASETS']
          dataload_datasets = '[]' unless dataload_datasets

          de_synchronize_all = options[:de_synchronize_all] || options['GDC_DE_SYNCHRONIZE_ALL']
          de_synchronize_all = 'true' unless de_synchronize_all
        else
          fail 'Executable has to be provided' if executable.blank?
        end
        fail 'Trigger schedule has to be provided' if trigger.blank?

        schedule = c.create(GoodData::Schedule, GoodData::Helpers.stringify_keys(GoodData::Helpers.deep_dup(SCHEDULE_TEMPLATE)), client: c, project: project)

        params = { 'PROCESS_ID' => process_id }
        if is_dataload_process
          params['GDC_DATALOAD_DATASETS'] = dataload_datasets
          params['GDC_DE_SYNCHRONIZE_ALL'] = de_synchronize_all
        else
          params['EXECUTABLE'] = executable
        end

        default_opts = {
          :type => 'MSETL',
          :timezone => 'UTC',
          :state => 'ENABLED',
          :params => params,
          # :reschedule => nil
        }

        schedule.name = options[:name]
        schedule.set_trigger(trigger)
        schedule.params = default_opts[:params].merge(options[:params] || {})
        schedule.hidden_params = options[:hidden_params] || {}
        schedule.timezone = options[:timezone] || default_opts[:timezone]
        schedule.state = options[:state] || default_opts[:state]
        schedule.schedule_type = options[:type] || default_opts[:type]
        schedule.reschedule = options[:reschedule] if options[:reschedule]
        schedule
      end
# Creates new schedules from parameters passed
#
# @param process_id [String] Process ID
# @param trigger [String|GoodData::Schedule] Trigger of schedule. Can be cron string or reference to another schedule.
# @param executable [String] Execution executable
# @param options [Hash] Optional options
# @return [GoodData::Schedule] New GoodData::Schedule instance
Creates new schedules from parameters passed
Creates new schedules from parameters passed
def create(process_id, trigger, executable, options = {})
        c, project = GoodData.get_client_and_project(options)
        fail 'Process ID has to be provided' if process_id.blank?
        is_dataload_process = Process[process_id, project: project, client: c].type == :dataload
        if is_dataload_process
          dataload_datasets = options[:dataload_datasets] || options['GDC_DATALOAD_DATASETS']
          dataload_datasets = '[]' unless dataload_datasets
          de_synchronize_all = options[:de_synchronize_all] || options['GDC_DE_SYNCHRONIZE_ALL']
          de_synchronize_all = 'true' unless de_synchronize_all
        else
          fail 'Executable has to be provided' if executable.blank?
        end
        fail 'Trigger schedule has to be provided' if trigger.blank?
        schedule = c.create(GoodData::Schedule, GoodData::Helpers.stringify_keys(GoodData::Helpers.deep_dup(SCHEDULE_TEMPLATE)), client: c, project: project)
        params = { 'PROCESS_ID' => process_id }
        if is_dataload_process
          params['GDC_DATALOAD_DATASETS'] = dataload_datasets
          params['GDC_DE_SYNCHRONIZE_ALL'] = de_synchronize_all
        else
          params['EXECUTABLE'] = executable
        end
        default_opts = {
          :type => 'MSETL',
          :timezone => 'UTC',
          :state => 'ENABLED',
          :params => params,
        }
        schedule.name = options[:name]
        schedule.set_trigger(trigger)
        schedule.params = default_opts[:params].merge(options[:params] || {})
        schedule.hidden_params = options[:hidden_params] || {}
        schedule.timezone = options[:timezone] || default_opts[:timezone]
        schedule.state = options[:state] || default_opts[:state]
        schedule.schedule_type = options[:type] || default_opts[:type]
        schedule.reschedule = options[:reschedule] if options[:reschedule]
        schedule
      end
def create ( process_id , trigger , executable , options = { } ) c , project = GoodData . get_client_and_project ( options ) fail 'Process ID has to be provided' if process_id . blank? is_dataload_process = Process [ process_id , project : project , client : c ] . type == :dataload if is_dataload_process dataload_datasets = options [ :dataload_datasets ] || options [ 'GDC_DATALOAD_DATASETS' ] dataload_datasets = '[]' unless dataload_datasets de_synchronize_all = options [ :de_synchronize_all ] || options [ 'GDC_DE_SYNCHRONIZE_ALL' ] de_synchronize_all = 'true' unless de_synchronize_all else fail 'Executable has to be provided' if executable . blank? end fail 'Trigger schedule has to be provided' if trigger . blank? schedule = c . create ( GoodData :: Schedule , GoodData :: Helpers . stringify_keys ( GoodData :: Helpers . deep_dup ( SCHEDULE_TEMPLATE ) ) , client : c , project : project ) params = { 'PROCESS_ID' => process_id } if is_dataload_process params [ 'GDC_DATALOAD_DATASETS' ] = dataload_datasets params [ 'GDC_DE_SYNCHRONIZE_ALL' ] = de_synchronize_all else params [ 'EXECUTABLE' ] = executable end default_opts = { :type => 'MSETL' , :timezone => 'UTC' , :state => 'ENABLED' , :params => params , } schedule . name = options [ :name ] schedule . set_trigger ( trigger ) schedule . params = default_opts [ :params ] . merge ( options [ :params ] || { } ) schedule . hidden_params = options [ :hidden_params ] || { } schedule . timezone = options [ :timezone ] || default_opts [ :timezone ] schedule . state = options [ :state ] || default_opts [ :state ] schedule . schedule_type = options [ :type ] || default_opts [ :type ] schedule . reschedule = options [ :reschedule ] if options [ :reschedule ] schedule end
Creates new schedules from parameters passed
Creates new schedules from parameters passed
# :reschedule => nil
New GoodData::Schedule instance
New GoodData :: Schedule instance
GoodData::Schedule
process_id
None
trigger
Trigger of schedule. Can be cron string or reference to another schedule.
Trigger of schedule . Can be cron string or reference to another schedule .
executable
None
options
None