Class: EcsDeployer::ScheduledTask::Client
- Inherits:
-
Object
- Object
- EcsDeployer::ScheduledTask::Client
- Defined in:
- lib/ecs_deployer/scheduled_task/client.rb
Instance Method Summary collapse
- #exist_rule?(rule) ⇒ Bool
- #initialize(cluster, aws_options = {}) ⇒ EcsDeployer::ScheduledTask::Client constructor
- #target_builder(id) ⇒ EcsDeployer::ScheduledTask::Target
- #update(rule, schedule_expression, targets = [], options = { description: nil }) ⇒ CloudWatchEvents::Types::PutRuleResponse
Constructor Details
#initialize(cluster, aws_options = {}) ⇒ EcsDeployer::ScheduledTask::Client
9 10 11 12 13 |
# File 'lib/ecs_deployer/scheduled_task/client.rb', line 9 def initialize(cluster, = {}) @cluster = cluster @cloud_watch_events = Aws::CloudWatchEvents::Client.new() = end |
Instance Method Details
#exist_rule?(rule) ⇒ Bool
17 18 19 20 21 22 |
# 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) ⇒ EcsDeployer::ScheduledTask::Target
26 27 28 |
# File 'lib/ecs_deployer/scheduled_task/client.rb', line 26 def target_builder(id) EcsDeployer::ScheduledTask::Target.new(@cluster, id, ) end |
#update(rule, schedule_expression, targets = [], options = { description: nil }) ⇒ CloudWatchEvents::Types::PutRuleResponse
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ecs_deployer/scheduled_task/client.rb', line 35 def update(rule, schedule_expression, targets = [], = { description: nil }) response = @cloud_watch_events.put_rule( name: rule, schedule_expression: schedule_expression, state: 'ENABLED', description: [:description] ) @cloud_watch_events.put_targets( rule: rule, targets: targets ) response end |