Skip to content

Commit

Permalink
Merge pull request boto#887 from graphaelli/add-PutNotificationConfig…
Browse files Browse the repository at this point in the history
…uration

add PutNotificationConfiguration support
  • Loading branch information
garnaat committed Aug 4, 2012
2 parents 0d846f9 + 934ac6a commit 741157b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions boto/ec2/autoscale/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,29 @@ def execute_policy(self, policy_name, as_group=None, honor_cooldown=None):
params['HonorCooldown'] = honor_cooldown
return self.get_status('ExecutePolicy', params)

def put_notification_configuration(self, autoscale_group, topic, notification_types):
"""
Configures an Auto Scaling group to send notifications when specified events take place.
:type as_group: str or :class:`boto.ec2.autoscale.group.AutoScalingGroup` object
:param as_group: The Auto Scaling group to put notification configuration on.
:type topic: str
:param topic: The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic.
:type notification_types: list
:param notification_types: The type of events that will trigger the notification.
"""

name = autoscale_group
if isinstance(autoscale_group, AutoScalingGroup):
name = autoscale_group.name

params = {'AutoScalingGroupName': name,
'TopicARN': topic}
self.build_list_params(params, notification_types, 'NotificationTypes')
return self.get_status('PutNotificationConfiguration', params)

def set_instance_health(self, instance_id, health_status,
should_respect_grace_period=True):
"""
Expand Down
6 changes: 6 additions & 0 deletions boto/ec2/autoscale/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ def get_activities(self, activity_ids=None, max_records=50):
return self.connection.get_all_activities(self, activity_ids,
max_records)

def put_notification_configuration(self, topic, notification_types):
"""
Configures an Auto Scaling group to send notifications when specified events take place.
"""
return self.connection.put_notification_configuration(self, topic, notification_types)

def suspend_processes(self, scaling_processes=None):
"""
Suspends Auto Scaling processes for an Auto Scaling group.
Expand Down

0 comments on commit 741157b

Please sign in to comment.