module AWS::SNS::FromAutoScaling
def self.extended base
def self.extended base base.origin = :autoscaling end
def applicable? sns
-
(Boolean)
- true when the SNS originates from auto-scaling
def applicable? sns sns['Subject'] =~ /.*autoscaling:.*/i end
def body
def body return @body if defined? @body @body = self.parse_from self.raw['Message'] end
def event
-
(Symbol)
- the auto-scaling event name
def event return @event if defined? @event e = body['Event'] @event = case when e =~ /EC2_INSTANCE_TERMINATE/ then :ec2_instance_terminate when e =~ /EC2_INSTANCE_TERMINATE_ERROR/ then :ec2_instance_terminate_error when e =~ /EC2_INSTANCE_LAUNCH/ then :ec2_instance_launch when e =~ /EC2_INSTANCE_LAUNCH_ERROR/ then :ec2_instance_launch_error when e =~ /TEST_NOTIFICATION/ then :test_notification else :unknown end end
def group_name
-
(String)
- the auto-scaling group name
def group_name body['AutoScalingGroupName'] end
def instance_id
-
(String)
- the instance-ID that is the subject of this event
def instance_id body['EC2InstanceId'] end
def status_code
def status_code body['StatusCode'] end