Sha256: 1cdb40d47c5a30bb8473a9b25a75c42ca14a4b180fb33f987137df9d64d94a85

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

#! /usr/bin/env ruby

require "cloud_shaped"
require "yaml"

module ScalingMacros

  def asg_adjustment(asg_resource_name, adjustment, cooldown = 120)
    resource("AWS::AutoScaling::ScalingPolicy") do |p|
      p["AdjustmentType"] = "ChangeInCapacity"
      p["AutoScalingGroupName"] = ref(asg_resource_name)
      p["ScalingAdjustment"] = adjustment
      p["Cooldown"] = cooldown
    end
  end

end

template = CloudShaped.template do

  extend(ScalingMacros)

  def_resource "upOne", :asg_adjustment, "autoScalingGroup", 1
  def_resource "downOne", :asg_adjustment, "autoScalingGroup", -1

end

puts YAML.dump(template)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloud_shaped-1.1.0 examples/macro.rb