{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Greengrass.DeleteFunctionDefinition
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a Lambda function definition.
module Amazonka.Greengrass.DeleteFunctionDefinition
  ( -- * Creating a Request
    DeleteFunctionDefinition (..),
    newDeleteFunctionDefinition,

    -- * Request Lenses
    deleteFunctionDefinition_functionDefinitionId,

    -- * Destructuring the Response
    DeleteFunctionDefinitionResponse (..),
    newDeleteFunctionDefinitionResponse,

    -- * Response Lenses
    deleteFunctionDefinitionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteFunctionDefinition' smart constructor.
data DeleteFunctionDefinition = DeleteFunctionDefinition'
  { -- | The ID of the Lambda function definition.
    DeleteFunctionDefinition -> Text
functionDefinitionId :: Prelude.Text
  }
  deriving (DeleteFunctionDefinition -> DeleteFunctionDefinition -> Bool
(DeleteFunctionDefinition -> DeleteFunctionDefinition -> Bool)
-> (DeleteFunctionDefinition -> DeleteFunctionDefinition -> Bool)
-> Eq DeleteFunctionDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFunctionDefinition -> DeleteFunctionDefinition -> Bool
$c/= :: DeleteFunctionDefinition -> DeleteFunctionDefinition -> Bool
== :: DeleteFunctionDefinition -> DeleteFunctionDefinition -> Bool
$c== :: DeleteFunctionDefinition -> DeleteFunctionDefinition -> Bool
Prelude.Eq, ReadPrec [DeleteFunctionDefinition]
ReadPrec DeleteFunctionDefinition
Int -> ReadS DeleteFunctionDefinition
ReadS [DeleteFunctionDefinition]
(Int -> ReadS DeleteFunctionDefinition)
-> ReadS [DeleteFunctionDefinition]
-> ReadPrec DeleteFunctionDefinition
-> ReadPrec [DeleteFunctionDefinition]
-> Read DeleteFunctionDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFunctionDefinition]
$creadListPrec :: ReadPrec [DeleteFunctionDefinition]
readPrec :: ReadPrec DeleteFunctionDefinition
$creadPrec :: ReadPrec DeleteFunctionDefinition
readList :: ReadS [DeleteFunctionDefinition]
$creadList :: ReadS [DeleteFunctionDefinition]
readsPrec :: Int -> ReadS DeleteFunctionDefinition
$creadsPrec :: Int -> ReadS DeleteFunctionDefinition
Prelude.Read, Int -> DeleteFunctionDefinition -> ShowS
[DeleteFunctionDefinition] -> ShowS
DeleteFunctionDefinition -> String
(Int -> DeleteFunctionDefinition -> ShowS)
-> (DeleteFunctionDefinition -> String)
-> ([DeleteFunctionDefinition] -> ShowS)
-> Show DeleteFunctionDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFunctionDefinition] -> ShowS
$cshowList :: [DeleteFunctionDefinition] -> ShowS
show :: DeleteFunctionDefinition -> String
$cshow :: DeleteFunctionDefinition -> String
showsPrec :: Int -> DeleteFunctionDefinition -> ShowS
$cshowsPrec :: Int -> DeleteFunctionDefinition -> ShowS
Prelude.Show, (forall x.
 DeleteFunctionDefinition -> Rep DeleteFunctionDefinition x)
-> (forall x.
    Rep DeleteFunctionDefinition x -> DeleteFunctionDefinition)
-> Generic DeleteFunctionDefinition
forall x.
Rep DeleteFunctionDefinition x -> DeleteFunctionDefinition
forall x.
DeleteFunctionDefinition -> Rep DeleteFunctionDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteFunctionDefinition x -> DeleteFunctionDefinition
$cfrom :: forall x.
DeleteFunctionDefinition -> Rep DeleteFunctionDefinition x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFunctionDefinition' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'functionDefinitionId', 'deleteFunctionDefinition_functionDefinitionId' - The ID of the Lambda function definition.
newDeleteFunctionDefinition ::
  -- | 'functionDefinitionId'
  Prelude.Text ->
  DeleteFunctionDefinition
newDeleteFunctionDefinition :: Text -> DeleteFunctionDefinition
newDeleteFunctionDefinition Text
pFunctionDefinitionId_ =
  DeleteFunctionDefinition' :: Text -> DeleteFunctionDefinition
DeleteFunctionDefinition'
    { $sel:functionDefinitionId:DeleteFunctionDefinition' :: Text
functionDefinitionId =
        Text
pFunctionDefinitionId_
    }

-- | The ID of the Lambda function definition.
deleteFunctionDefinition_functionDefinitionId :: Lens.Lens' DeleteFunctionDefinition Prelude.Text
deleteFunctionDefinition_functionDefinitionId :: (Text -> f Text)
-> DeleteFunctionDefinition -> f DeleteFunctionDefinition
deleteFunctionDefinition_functionDefinitionId = (DeleteFunctionDefinition -> Text)
-> (DeleteFunctionDefinition -> Text -> DeleteFunctionDefinition)
-> Lens DeleteFunctionDefinition DeleteFunctionDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFunctionDefinition' {Text
functionDefinitionId :: Text
$sel:functionDefinitionId:DeleteFunctionDefinition' :: DeleteFunctionDefinition -> Text
functionDefinitionId} -> Text
functionDefinitionId) (\s :: DeleteFunctionDefinition
s@DeleteFunctionDefinition' {} Text
a -> DeleteFunctionDefinition
s {$sel:functionDefinitionId:DeleteFunctionDefinition' :: Text
functionDefinitionId = Text
a} :: DeleteFunctionDefinition)

instance Core.AWSRequest DeleteFunctionDefinition where
  type
    AWSResponse DeleteFunctionDefinition =
      DeleteFunctionDefinitionResponse
  request :: DeleteFunctionDefinition -> Request DeleteFunctionDefinition
request = Service
-> DeleteFunctionDefinition -> Request DeleteFunctionDefinition
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteFunctionDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFunctionDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteFunctionDefinition))
-> Logger
-> Service
-> Proxy DeleteFunctionDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFunctionDefinition)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteFunctionDefinitionResponse
DeleteFunctionDefinitionResponse'
            (Int -> DeleteFunctionDefinitionResponse)
-> Either String Int
-> Either String DeleteFunctionDefinitionResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteFunctionDefinition

instance Prelude.NFData DeleteFunctionDefinition

instance Core.ToHeaders DeleteFunctionDefinition where
  toHeaders :: DeleteFunctionDefinition -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteFunctionDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DeleteFunctionDefinition where
  toPath :: DeleteFunctionDefinition -> ByteString
toPath DeleteFunctionDefinition' {Text
functionDefinitionId :: Text
$sel:functionDefinitionId:DeleteFunctionDefinition' :: DeleteFunctionDefinition -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/greengrass/definition/functions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
functionDefinitionId
      ]

instance Core.ToQuery DeleteFunctionDefinition where
  toQuery :: DeleteFunctionDefinition -> QueryString
toQuery = QueryString -> DeleteFunctionDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDeleteFunctionDefinitionResponse' smart constructor.
data DeleteFunctionDefinitionResponse = DeleteFunctionDefinitionResponse'
  { -- | The response's http status code.
    DeleteFunctionDefinitionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteFunctionDefinitionResponse
-> DeleteFunctionDefinitionResponse -> Bool
(DeleteFunctionDefinitionResponse
 -> DeleteFunctionDefinitionResponse -> Bool)
-> (DeleteFunctionDefinitionResponse
    -> DeleteFunctionDefinitionResponse -> Bool)
-> Eq DeleteFunctionDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFunctionDefinitionResponse
-> DeleteFunctionDefinitionResponse -> Bool
$c/= :: DeleteFunctionDefinitionResponse
-> DeleteFunctionDefinitionResponse -> Bool
== :: DeleteFunctionDefinitionResponse
-> DeleteFunctionDefinitionResponse -> Bool
$c== :: DeleteFunctionDefinitionResponse
-> DeleteFunctionDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [DeleteFunctionDefinitionResponse]
ReadPrec DeleteFunctionDefinitionResponse
Int -> ReadS DeleteFunctionDefinitionResponse
ReadS [DeleteFunctionDefinitionResponse]
(Int -> ReadS DeleteFunctionDefinitionResponse)
-> ReadS [DeleteFunctionDefinitionResponse]
-> ReadPrec DeleteFunctionDefinitionResponse
-> ReadPrec [DeleteFunctionDefinitionResponse]
-> Read DeleteFunctionDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFunctionDefinitionResponse]
$creadListPrec :: ReadPrec [DeleteFunctionDefinitionResponse]
readPrec :: ReadPrec DeleteFunctionDefinitionResponse
$creadPrec :: ReadPrec DeleteFunctionDefinitionResponse
readList :: ReadS [DeleteFunctionDefinitionResponse]
$creadList :: ReadS [DeleteFunctionDefinitionResponse]
readsPrec :: Int -> ReadS DeleteFunctionDefinitionResponse
$creadsPrec :: Int -> ReadS DeleteFunctionDefinitionResponse
Prelude.Read, Int -> DeleteFunctionDefinitionResponse -> ShowS
[DeleteFunctionDefinitionResponse] -> ShowS
DeleteFunctionDefinitionResponse -> String
(Int -> DeleteFunctionDefinitionResponse -> ShowS)
-> (DeleteFunctionDefinitionResponse -> String)
-> ([DeleteFunctionDefinitionResponse] -> ShowS)
-> Show DeleteFunctionDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFunctionDefinitionResponse] -> ShowS
$cshowList :: [DeleteFunctionDefinitionResponse] -> ShowS
show :: DeleteFunctionDefinitionResponse -> String
$cshow :: DeleteFunctionDefinitionResponse -> String
showsPrec :: Int -> DeleteFunctionDefinitionResponse -> ShowS
$cshowsPrec :: Int -> DeleteFunctionDefinitionResponse -> ShowS
Prelude.Show, (forall x.
 DeleteFunctionDefinitionResponse
 -> Rep DeleteFunctionDefinitionResponse x)
-> (forall x.
    Rep DeleteFunctionDefinitionResponse x
    -> DeleteFunctionDefinitionResponse)
-> Generic DeleteFunctionDefinitionResponse
forall x.
Rep DeleteFunctionDefinitionResponse x
-> DeleteFunctionDefinitionResponse
forall x.
DeleteFunctionDefinitionResponse
-> Rep DeleteFunctionDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteFunctionDefinitionResponse x
-> DeleteFunctionDefinitionResponse
$cfrom :: forall x.
DeleteFunctionDefinitionResponse
-> Rep DeleteFunctionDefinitionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFunctionDefinitionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'deleteFunctionDefinitionResponse_httpStatus' - The response's http status code.
newDeleteFunctionDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteFunctionDefinitionResponse
newDeleteFunctionDefinitionResponse :: Int -> DeleteFunctionDefinitionResponse
newDeleteFunctionDefinitionResponse Int
pHttpStatus_ =
  DeleteFunctionDefinitionResponse' :: Int -> DeleteFunctionDefinitionResponse
DeleteFunctionDefinitionResponse'
    { $sel:httpStatus:DeleteFunctionDefinitionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteFunctionDefinitionResponse_httpStatus :: Lens.Lens' DeleteFunctionDefinitionResponse Prelude.Int
deleteFunctionDefinitionResponse_httpStatus :: (Int -> f Int)
-> DeleteFunctionDefinitionResponse
-> f DeleteFunctionDefinitionResponse
deleteFunctionDefinitionResponse_httpStatus = (DeleteFunctionDefinitionResponse -> Int)
-> (DeleteFunctionDefinitionResponse
    -> Int -> DeleteFunctionDefinitionResponse)
-> Lens
     DeleteFunctionDefinitionResponse
     DeleteFunctionDefinitionResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFunctionDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteFunctionDefinitionResponse' :: DeleteFunctionDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteFunctionDefinitionResponse
s@DeleteFunctionDefinitionResponse' {} Int
a -> DeleteFunctionDefinitionResponse
s {$sel:httpStatus:DeleteFunctionDefinitionResponse' :: Int
httpStatus = Int
a} :: DeleteFunctionDefinitionResponse)

instance
  Prelude.NFData
    DeleteFunctionDefinitionResponse