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

[aws] Add suboptions to aws_application_scaling_policy (#43042)

* [aws] Add suboptions to aws_application_scaling_policy

Fixes #42917

* Remove any suboptions that are None
This commit is contained in:
Ryan Brown 2018-09-05 12:35:26 -04:00 committed by GitHub
parent 70f3f084ac
commit 9d1bf32825
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -170,7 +170,7 @@ policy_name:
policy_type: policy_type:
description: The policy type. description: The policy type.
returned: when state present returned: when state present
type: string type: string
min_capacity: min_capacity:
description: The minimum value to scale to in response to a scale in event. Required if I(state) is C(present). description: The minimum value to scale to in response to a scale in event. Required if I(state) is C(present).
returned: when state present returned: when state present
@ -197,7 +197,7 @@ step_scaling_policy_configuration:
type: string type: string
sample: "ChangeInCapacity, PercentChangeInCapacity, ExactCapacity" sample: "ChangeInCapacity, PercentChangeInCapacity, ExactCapacity"
cooldown: cooldown:
description: The amount of time, in seconds, after a scaling activity completes description: The amount of time, in seconds, after a scaling activity completes
where previous trigger-related scaling activities can influence future scaling events where previous trigger-related scaling activities can influence future scaling events
returned: when state present and the policy type is StepScaling returned: when state present and the policy type is StepScaling
type: int type: int
@ -462,7 +462,18 @@ def main():
], type='str'), ], type='str'),
policy_type=dict(required=True, choices=['StepScaling', 'TargetTrackingScaling'], type='str'), policy_type=dict(required=True, choices=['StepScaling', 'TargetTrackingScaling'], type='str'),
step_scaling_policy_configuration=dict(required=False, type='dict'), step_scaling_policy_configuration=dict(required=False, type='dict'),
target_tracking_scaling_policy_configuration=dict(required=False, type='dict'), target_tracking_scaling_policy_configuration=dict(
required=False,
type='dict',
options=dict(
CustomizedMetricSpecification=dict(type='dict'),
DisableScaleIn=dict(type='bool'),
PredefinedMetricSpecification=dict(type='dict'),
ScaleInCooldown=dict(type='int'),
ScaleOutCooldown=dict(type='int'),
TargetValue=dict(type='float'),
)
),
minimum_tasks=dict(required=False, type='int'), minimum_tasks=dict(required=False, type='int'),
maximum_tasks=dict(required=False, type='int'), maximum_tasks=dict(required=False, type='int'),
override_task_capacity=dict(required=False, type=bool) override_task_capacity=dict(required=False, type=bool)
@ -472,6 +483,15 @@ def main():
connection = module.client('application-autoscaling') connection = module.client('application-autoscaling')
# Remove any target_tracking_scaling_policy_configuration suboptions that are None
policy_config_options = [
'CustomizedMetricSpecification', 'DisableScaleIn', 'PredefinedMetricSpecification', 'ScaleInCooldown', 'ScaleOutCooldown', 'TargetValue'
]
if isinstance(module.params['target_tracking_scaling_policy_configuration'], dict):
for option in policy_config_options:
if module.params['target_tracking_scaling_policy_configuration'][option] is None:
module.params['target_tracking_scaling_policy_configuration'].pop(option)
if module.params.get("state") == 'present': if module.params.get("state") == 'present':
# A scalable target must be registered prior to creating a scaling policy # A scalable target must be registered prior to creating a scaling policy
scalable_target_result = create_scalable_target(connection, module) scalable_target_result = create_scalable_target(connection, module)