mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
d60ec0bff5
- implement describe_notification_configurations - implement mocks for (delete|put)_notification_configurations - tests for *_notification_configurations - delete notification configurations in delete_auto_scaling_group mock
79 lines
3 KiB
Ruby
79 lines
3 KiB
Ruby
module Fog
|
|
module AWS
|
|
class AutoScaling
|
|
|
|
class Real
|
|
|
|
require 'fog/aws/parsers/auto_scaling/describe_notification_configurations'
|
|
|
|
# Returns a list of notification actions associated with Auto Scaling
|
|
# groups for specified events.
|
|
#
|
|
# ==== Parameters
|
|
# * options<~Hash>:
|
|
# * 'AutoScalingGroupsName'<~String> - The name of the Auto Scaling
|
|
# group.
|
|
# * 'MaxRecords'<~Integer> - The maximum number of records to return.
|
|
# * 'NextToken'<~String> - A string that is used to mark the start of
|
|
# the next batch of returned results for pagination.
|
|
#
|
|
# ==== Returns
|
|
# * response<~Excon::Response>:
|
|
# * body<~Hash>:
|
|
# * 'ResponseMetadata'<~Hash>:
|
|
# * 'RequestId'<~String> - Id of request
|
|
# * 'DescribeNotificationConfigurationsResult'<~Hash>:
|
|
# * 'NotificationConfigurations'<~Array>:
|
|
# * notificationConfiguration<~Hash>:
|
|
# * 'AutoScalingGroupName'<~String> - Specifies the Auto
|
|
# Scaling group name.
|
|
# * 'NotificationType'<~String> - The types of events for an
|
|
# action to start.
|
|
# * 'TopicARN'<~String> - The Amazon Resource Name (ARN) of the
|
|
# Amazon Simple Notification Service (SNS) topic.
|
|
#
|
|
# ==== See Also
|
|
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_DescribeNotificationConfigurations.html
|
|
#
|
|
def describe_notification_configurations(options = {})
|
|
if auto_scaling_group_names = options.delete('AutoScalingGroupNames')
|
|
options.merge!(AWS.indexed_param('AutoScalingGroupNames.member.%d', [*auto_scaling_group_names]))
|
|
end
|
|
request({
|
|
'Action' => 'DescribeNotificationConfigurations',
|
|
:parser => Fog::Parsers::AWS::AutoScaling::DescribeNotificationConfigurations.new
|
|
}.merge!(options))
|
|
end
|
|
|
|
end
|
|
|
|
class Mock
|
|
|
|
def describe_notification_configurations(options = {})
|
|
results = { 'NotificationConfigurations' => [] }
|
|
(options['AutoScalingGroupNames']||self.data[:notification_configurations].keys).each do |asg_name|
|
|
(self.data[:notification_configurations][asg_name]||{}).each do |topic_arn, notification_types|
|
|
notification_types.each do |notification_type|
|
|
results['NotificationConfigurations'] << {
|
|
'AutoScalingGroupName' => asg_name,
|
|
'NotificationType' => notification_type,
|
|
'TopicARN' => topic_arn,
|
|
}
|
|
end
|
|
end
|
|
end
|
|
|
|
response = Excon::Response.new
|
|
response.status = 200
|
|
response.body = {
|
|
'DescribeNotificationConfigurationsResult' => results,
|
|
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
|
}
|
|
response
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|