{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Greengrass.Types
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
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]
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
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.
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'
    { $sel:functionDefinitionId:DeleteFunctionDefinition' :: Text
functionDefinitionId =
        Text
pFunctionDefinitionId_
    }

-- | The ID of the Lambda function definition.
deleteFunctionDefinition_functionDefinitionId :: Lens.Lens' DeleteFunctionDefinition Prelude.Text
deleteFunctionDefinition_functionDefinitionId :: Lens' DeleteFunctionDefinition Text
deleteFunctionDefinition_functionDefinitionId = 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 :: (Service -> Service)
-> DeleteFunctionDefinition -> Request DeleteFunctionDefinition
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteFunctionDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFunctionDefinition)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteFunctionDefinitionResponse
DeleteFunctionDefinitionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteFunctionDefinition where
  hashWithSalt :: Int -> DeleteFunctionDefinition -> Int
hashWithSalt Int
_salt DeleteFunctionDefinition' {Text
functionDefinitionId :: Text
$sel:functionDefinitionId:DeleteFunctionDefinition' :: DeleteFunctionDefinition -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
functionDefinitionId

instance Prelude.NFData DeleteFunctionDefinition where
  rnf :: DeleteFunctionDefinition -> ()
rnf DeleteFunctionDefinition' {Text
functionDefinitionId :: Text
$sel:functionDefinitionId:DeleteFunctionDefinition' :: DeleteFunctionDefinition -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
functionDefinitionId

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

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

instance Data.ToQuery DeleteFunctionDefinition where
  toQuery :: DeleteFunctionDefinition -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DeleteFunctionDefinitionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteFunctionDefinitionResponse_httpStatus :: Lens.Lens' DeleteFunctionDefinitionResponse Prelude.Int
deleteFunctionDefinitionResponse_httpStatus :: Lens' DeleteFunctionDefinitionResponse Int
deleteFunctionDefinitionResponse_httpStatus = 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
  where
  rnf :: DeleteFunctionDefinitionResponse -> ()
rnf DeleteFunctionDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteFunctionDefinitionResponse' :: DeleteFunctionDefinitionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus