Class: Awslive::PauseScheduleAction

Inherits:
Object
  • Object
show all
Defined in:
lib/awslive-scheduler/pause_schedule_action.rb

Constant Summary collapse

PAUSE_HASH =
{
    :action_name => "pause",
    :schedule_action_start_settings => {
        :fixed_mode_schedule_action_start_settings => {
            :time => "2019-12-22T14:36:01.302Z"
        }
    },
    :schedule_action_settings => {
        :pause_state_settings => {
            :pipelines => []
        }
    }
}

Instance Method Summary collapse

Instance Method Details

#get_action_idObject



45
46
47
# File 'lib/awslive-scheduler/pause_schedule_action.rb', line 45

def get_action_id
  Time.now.to_i
end

#get_pause_schedule_action(type) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/awslive-scheduler/pause_schedule_action.rb', line 18

def get_pause_schedule_action(type)
  action_hash = PAUSE_HASH.clone
  action_hash[:action_name] = "#{get_action_id}"
  exec_time = ( Time.now.utc + 30 ).iso8601
  action_hash[:schedule_action_start_settings][:fixed_mode_schedule_action_start_settings][:time] = "#{exec_time}"
  pipelines = []
  pipelines << {
      pipeline_id: "PIPELINE_0"
  }
  if type == "STANDARD"
    pipelines << {
        pipeline_id: "PIPELINE_1"
    }
  end
  action_hash[:schedule_action_settings][:pause_state_settings][:pipelines] = pipelines
  puts "#{action_hash}"
  action_hash
end

#get_unpause_schedule_actionObject



37
38
39
40
41
42
43
# File 'lib/awslive-scheduler/pause_schedule_action.rb', line 37

def get_unpause_schedule_action
  action_hash = PAUSE_HASH.clone
  action_hash[:action_name] = "#{get_action_id}"
  exec_time = ( Time.now.utc + 30 ).iso8601
  action_hash[:schedule_action_start_settings][:fixed_mode_schedule_action_start_settings][:time] = "#{exec_time}"
  action_hash
end