1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/requests/auto_scaling/delete_policy.rb
Josh Lane d48d376e9c initial import
* take the liberty of correcting Aws naming
2014-12-31 09:17:51 -08:00

50 lines
1.6 KiB
Ruby

module Fog
module AWS
class AutoScaling
class Real
require 'fog/aws/parsers/auto_scaling/basic'
# Deletes a policy created by put_scaling_policy
#
# ==== Parameters
# * auto_scaling_group_name<~String> - The name of the Auto Scaling
# group.
# * policy_name<~String> - The name or PolicyARN of the policy you want
# to delete.
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'ResponseMetadata'<~Hash>:
# * 'RequestId'<~String> - Id of request
#
# ==== See Also
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_DeletePolicy.html
#
def delete_policy(auto_scaling_group_name, policy_name)
request({
'Action' => 'DeletePolicy',
'AutoScalingGroupName' => auto_scaling_group_name,
'PolicyName' => policy_name,
:parser => Fog::Parsers::AWS::AutoScaling::Basic.new
})
end
end
class Mock
def delete_policy(auto_scaling_group_name, policy_name)
unless self.data[:scaling_policies].delete(policy_name)
raise Fog::AWS::AutoScaling::NotFound, "The scaling policy '#{policy_name}' does not exist."
end
response = Excon::Response.new
response.status = 200
response.body = {
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
}
response
end
end
end
end
end