scaling_policy#

Exec module for managing Scaling policies.

async idem_aws.exec.aws.autoscaling.scaling_policy.get(hub, ctx, name, auto_scaling_group_name: str, resource_id: str = None, policy_type: str = None) Dict[source]#

Retrieves the specified scaling policy.

Use an un-managed scaling policy as a data-source. Supply one of the inputs as the filter. If resource_id is set, autoscaling group is searched based on the resource_id and policy_type is ignored.

Parameters:
  • name (str) – The name of the Idem state.

  • auto_scaling_group_name (str) – The name of the Auto Scaling group.

  • resource_id (str, Optional) – Name of the Auto Scaling group’s policy.

  • policy_type (str, Optional) – Type of Auto Scaling group’s policy. This is used to fetch a policy if resource_id is not specified.

Returns:

{"result": True|False, "comment": list, "ret": None|dict}

Examples

Calling this exec module function from the cli with resource_id

idem exec aws.autoscaling.scaling_policy.get auto_scaling_group_name="asg_1" resource_id="resource_id"

Calling this exec module function from within a state module in pure python

async def state_function(hub, ctx, name, auto_scaling_group_name, resource_id):
    ret = await hub.exec.aws.autoscaling.scaling_policy.get(
        ctx=ctx,
        name=name,
        resource_id=resource_id,
        auto_scaling_group_name=auto_scaling_group_name
    )