Class: EcsDeploy::ScheduledTask

Inherits:
Object
  • Object
show all
Defined in:
lib/ecs_deploy/scheduled_task.rb

Defined Under Namespace

Classes: PutTargetsFailure

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster:, rule_name:, schedule_expression:, enabled: true, description: nil, target_id: nil, task_definition_name:, revision: nil, task_count: nil, role_arn:, network_configuration: nil, launch_type: nil, platform_version: nil, group: nil, region: nil, container_overrides: nil) ⇒ ScheduledTask

Returns a new instance of ScheduledTask.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ecs_deploy/scheduled_task.rb', line 10

def initialize(
  cluster:, rule_name:, schedule_expression:, enabled: true, description: nil, target_id: nil,
  task_definition_name:, revision: nil, task_count: nil, role_arn:, network_configuration: nil, launch_type: nil, platform_version: nil, group: nil,
  region: nil, container_overrides: nil
)
  @cluster = cluster
  @rule_name = rule_name
  @schedule_expression = schedule_expression
  @enabled = enabled
  @description = description
  @target_id = target_id || task_definition_name
  @task_definition_name = task_definition_name
  @task_count = task_count || 1
  @revision = revision
  @role_arn = role_arn
  @network_configuration = network_configuration
  @launch_type = launch_type || "EC2"
  @platform_version = platform_version
  @group = group
  region ||= EcsDeploy.config.default_region
  params ||= EcsDeploy.config.ecs_client_params
  @container_overrides = container_overrides

  @client = region ? Aws::ECS::Client.new(params.merge(region: region)) : Aws::ECS::Client.new(params)
  @region = @client.config.region
  @cloud_watch_events = Aws::CloudWatchEvents::Client.new(region: @region)
end

Instance Attribute Details

#clusterObject (readonly)

Returns the value of attribute cluster.



8
9
10
# File 'lib/ecs_deploy/scheduled_task.rb', line 8

def cluster
  @cluster
end

#regionObject (readonly)

Returns the value of attribute region.



8
9
10
# File 'lib/ecs_deploy/scheduled_task.rb', line 8

def region
  @region
end

#schedule_rule_nameObject (readonly)

Returns the value of attribute schedule_rule_name.



8
9
10
# File 'lib/ecs_deploy/scheduled_task.rb', line 8

def schedule_rule_name
  @schedule_rule_name
end

Instance Method Details

#deployObject



38
39
40
41
# File 'lib/ecs_deploy/scheduled_task.rb', line 38

def deploy
  put_rule
  put_targets
end