class EcsDeployer::ScheduledTask::Client
Public Class Methods
new(cluster, aws_options = {})
click to toggle source
@param [String] cluster @param [Hash] aws_options @return [EcsDeployer::ScheduledTask::Client]
# File lib/ecs_deployer/scheduled_task/client.rb, line 9 def initialize(cluster, aws_options = {}) @cluster = cluster @cloud_watch_events = Aws::CloudWatchEvents::Client.new(aws_options) @aws_options = aws_options end
Public Instance Methods
exist_rule?(rule)
click to toggle source
@param [String] rule @return [Bool]
# File lib/ecs_deployer/scheduled_task/client.rb, line 17 def exist_rule?(rule) @cloud_watch_events.describe_rule(name: rule) true rescue Aws::CloudWatchEvents::Errors::ResourceNotFoundException false end
target_builder(id)
click to toggle source
@param [String] id @return [EcsDeployer::ScheduledTask::Target]
# File lib/ecs_deployer/scheduled_task/client.rb, line 26 def target_builder(id) EcsDeployer::ScheduledTask::Target.new(@cluster, id, @aws_options) end
update(rule, schedule_expression, targets = [], options = { description: nil })
click to toggle source
@param [String] rule @param [String] schedule_expression @param [Array] targets @param [Hash] options @return [CloudWatchEvents::Types::PutRuleResponse]
# File lib/ecs_deployer/scheduled_task/client.rb, line 35 def update(rule, schedule_expression, targets = [], options = { description: nil }) response = @cloud_watch_events.put_rule( name: rule, schedule_expression: schedule_expression, state: 'ENABLED', description: options[:description] ) @cloud_watch_events.put_targets( rule: rule, targets: targets ) response end