mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #869 from OxygenCloud/master
[AWS|Auto Scale] Add support for PutNotificationConfiguration
This commit is contained in:
commit
b4bff0df0e
3 changed files with 80 additions and 1 deletions
|
@ -32,6 +32,7 @@ module Fog
|
|||
request :execute_policy
|
||||
request :put_scaling_policy
|
||||
request :put_scheduled_update_group_action
|
||||
request :put_notification_configuration
|
||||
request :resume_processes
|
||||
request :set_desired_capacity
|
||||
request :set_instance_health
|
||||
|
@ -103,7 +104,7 @@ module Fog
|
|||
:host => @host,
|
||||
:path => @path,
|
||||
:port => @port,
|
||||
:version => '2010-08-01'
|
||||
:version => '2011-01-01'
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module AutoScaling
|
||||
|
||||
class PutNotificationConfiguration < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@response = { 'ResponseMetadata' => {} }
|
||||
end
|
||||
|
||||
def start_element(name, attrs = [])
|
||||
super
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'RequestId'
|
||||
@response['ResponseMetadata'][name] = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,51 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class AutoScaling
|
||||
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/auto_scaling/put_notification_configuration'
|
||||
|
||||
# Creates a notification configuration for an Auto Scaling group. To update an
|
||||
# existing policy, overwrite the existing notification configuration name
|
||||
# and set the parameter(s) you want to change.
|
||||
#
|
||||
# ==== Parameters
|
||||
# * auto_scaling_group_name<~String> - The name of the Auto Scaling group.
|
||||
# * notification_types<~Array> - The type of events that will trigger the
|
||||
# notification.
|
||||
# * topic_arn<~String> - The Amazon Resource Name (ARN) of the Amazon
|
||||
# Simple Notification Service (SNS) topic.
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'ResponseMetadata'<~Hash>:
|
||||
# * 'RequestId'<~String> - Id of request
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_PutNotificationConfiguration.html
|
||||
#
|
||||
def put_notification_configuration(auto_scaling_group_name, notification_types, topic_arn)
|
||||
options = {}
|
||||
options.merge!(AWS.indexed_param('NotificationTypes.member.%d', [*notification_types]))
|
||||
request({
|
||||
'Action' => 'PutNotificationConfiguration',
|
||||
'AutoScalingGroupName' => auto_scaling_group_name,
|
||||
'TopicARN' => topic_arn,
|
||||
:parser => Fog::Parsers::AWS::AutoScaling::PutNotificationConfiguration.new
|
||||
}.merge!(options))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def put_notification_configuration(auto_scaling_group_name, notification_types, topic_arn)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue