1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

support ecs task resource for cloudwatchevent_rule (#28495)

* add support ecs

* add role_arn parameters
This commit is contained in:
opapy 2017-08-30 05:13:12 +09:00 committed by Sloane Hertel
parent 4b4c946b4b
commit 38a5033b48

View file

@ -63,14 +63,18 @@ options:
targets:
description:
- "A dictionary array of targets to add to or update for the rule, in the
form C({ id: [string], arn: [string], input: [valid JSON string], input_path: [valid JSONPath string] }).
form C({ id: [string], arn: [string], role_arn: [string], input: [valid JSON string],
input_path: [valid JSONPath string], ecs_parameters: {task_definition_arn: [string], task_count: [int]}}).
I(id) [required] is the unique target assignment ID. I(arn) (required)
is the Amazon Resource Name associated with the target. I(input)
is the Amazon Resource Name associated with the target. I(role_arn) (optional) is The Amazon Resource Name
of the IAM role to be used for this target when the rule is triggered. I(input)
(optional) is a JSON object that will override the event data when
passed to the target. I(input_path) (optional) is a JSONPath string
(e.g. C($.detail)) that specifies the part of the event data to be
passed to the target. If neither I(input) nor I(input_path) is
specified, then the entire event is passed to the target in JSON form."
specified, then the entire event is passed to the target in JSON form.
I(task_definition_arn) [optional] is ecs task definition arn.
I(task_count) [optional] is ecs task count."
required: false
'''
@ -234,6 +238,15 @@ class CloudWatchEventRule(object):
target_request['Input'] = target['input']
if 'input_path' in target:
target_request['InputPath'] = target['input_path']
if 'role_arn' in target:
target_request['RoleArn'] = target['role_arn']
if 'ecs_parameters' in target:
target_request['EcsParameters'] = {}
ecs_parameters = target['ecs_parameters']
if 'task_definition_arn' in target['ecs_parameters']:
target_request['EcsParameters']['TaskDefinitionArn'] = ecs_parameters['task_definition_arn']
if 'task_count' in target['ecs_parameters']:
target_request['EcsParameters']['TaskCount'] = ecs_parameters['task_count']
targets_request.append(target_request)
return targets_request