Sha256: 7fea27f14d1ced0e00c7ef4ac0f7c4b2d07c3b38e589c6cfd6b75c8db196a043
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require 'aws-sdk' module EcsDeployer module ScheduledTask class Client # @param [String] cluster # @param [Hash] aws_options # @return [EcsDeployer::ScheduledTask::Client] def initialize(cluster, aws_options = {}) @cluster = cluster @cloud_watch_events = Aws::CloudWatchEvents::Client.new(aws_options) @aws_options = aws_options end # @param [String] rule # @return [Bool] def exist_rule?(rule) @cloud_watch_events.describe_rule(name: rule) true rescue Aws::CloudWatchEvents::Errors::ResourceNotFoundException false end # @param [String] id # @return [EcsDeployer::ScheduledTask::Target] def target_builder(id) EcsDeployer::ScheduledTask::Target.new(@cluster, id, @aws_options) end # @param [String] rule # @param [String] schedule_expression # @param [Array] targets # @param [Hash] options # @return [CloudWatchEvents::Types::PutRuleResponse] 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ecs_deployer-2.1.6 | lib/ecs_deployer/scheduled_task/client.rb |