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/lambda/delete_function.rb

44 lines
1.2 KiB
Ruby
Raw Normal View History

2015-06-22 20:05:47 -04:00
module Fog
module AWS
class Lambda
class Real
# Deletes the specified Lambda function code and configuration.
# http://docs.aws.amazon.com/lambda/latest/dg/API_DeleteFunction.html
# ==== Parameters
# * FunctionName <~String> - Lambda function to delete.
# ==== Returns
# * response<~Excon::Response>:
# * body<~String>:
def delete_function(params={})
function_name = params.delete('FunctionName')
request({
:method => 'DELETE',
:path => "/functions/#{function_name}",
:expects => 204
}.merge(params))
end
end
class Mock
def delete_function(params={})
response = Excon::Response.new
response.status = 204
response.body = ''
function = self.get_function_configuration(params).body
function_id = function['FunctionArn']
self.data[:functions].delete function_id
self.data[:permissions].delete function_id
self.data[:event_source_mappings].delete_if do |m,f|
f['FunctionArn'].eql?(function_id)
end
response
end
end
end
end
end