{-# 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.Lambda.DeleteFunctionUrlConfig
-- 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 URL. When you delete a function URL, you
-- can\'t recover it. Creating a new function URL results in a different
-- URL address.
module Amazonka.Lambda.DeleteFunctionUrlConfig
  ( -- * Creating a Request
    DeleteFunctionUrlConfig (..),
    newDeleteFunctionUrlConfig,

    -- * Request Lenses
    deleteFunctionUrlConfig_qualifier,
    deleteFunctionUrlConfig_functionName,

    -- * Destructuring the Response
    DeleteFunctionUrlConfigResponse (..),
    newDeleteFunctionUrlConfigResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lambda.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteFunctionUrlConfig' smart constructor.
data DeleteFunctionUrlConfig = DeleteFunctionUrlConfig'
  { -- | The alias name.
    DeleteFunctionUrlConfig -> Maybe Text
qualifier :: Prelude.Maybe Prelude.Text,
    -- | The name of the Lambda function.
    --
    -- __Name formats__
    --
    -- -   __Function name__ – @my-function@.
    --
    -- -   __Function ARN__ –
    --     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
    --
    -- -   __Partial ARN__ – @123456789012:function:my-function@.
    --
    -- The length constraint applies only to the full ARN. If you specify only
    -- the function name, it is limited to 64 characters in length.
    DeleteFunctionUrlConfig -> Text
functionName :: Prelude.Text
  }
  deriving (DeleteFunctionUrlConfig -> DeleteFunctionUrlConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFunctionUrlConfig -> DeleteFunctionUrlConfig -> Bool
$c/= :: DeleteFunctionUrlConfig -> DeleteFunctionUrlConfig -> Bool
== :: DeleteFunctionUrlConfig -> DeleteFunctionUrlConfig -> Bool
$c== :: DeleteFunctionUrlConfig -> DeleteFunctionUrlConfig -> Bool
Prelude.Eq, ReadPrec [DeleteFunctionUrlConfig]
ReadPrec DeleteFunctionUrlConfig
Int -> ReadS DeleteFunctionUrlConfig
ReadS [DeleteFunctionUrlConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFunctionUrlConfig]
$creadListPrec :: ReadPrec [DeleteFunctionUrlConfig]
readPrec :: ReadPrec DeleteFunctionUrlConfig
$creadPrec :: ReadPrec DeleteFunctionUrlConfig
readList :: ReadS [DeleteFunctionUrlConfig]
$creadList :: ReadS [DeleteFunctionUrlConfig]
readsPrec :: Int -> ReadS DeleteFunctionUrlConfig
$creadsPrec :: Int -> ReadS DeleteFunctionUrlConfig
Prelude.Read, Int -> DeleteFunctionUrlConfig -> ShowS
[DeleteFunctionUrlConfig] -> ShowS
DeleteFunctionUrlConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFunctionUrlConfig] -> ShowS
$cshowList :: [DeleteFunctionUrlConfig] -> ShowS
show :: DeleteFunctionUrlConfig -> String
$cshow :: DeleteFunctionUrlConfig -> String
showsPrec :: Int -> DeleteFunctionUrlConfig -> ShowS
$cshowsPrec :: Int -> DeleteFunctionUrlConfig -> ShowS
Prelude.Show, forall x. Rep DeleteFunctionUrlConfig x -> DeleteFunctionUrlConfig
forall x. DeleteFunctionUrlConfig -> Rep DeleteFunctionUrlConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFunctionUrlConfig x -> DeleteFunctionUrlConfig
$cfrom :: forall x. DeleteFunctionUrlConfig -> Rep DeleteFunctionUrlConfig x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFunctionUrlConfig' 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:
--
-- 'qualifier', 'deleteFunctionUrlConfig_qualifier' - The alias name.
--
-- 'functionName', 'deleteFunctionUrlConfig_functionName' - The name of the Lambda function.
--
-- __Name formats__
--
-- -   __Function name__ – @my-function@.
--
-- -   __Function ARN__ –
--     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
--
-- -   __Partial ARN__ – @123456789012:function:my-function@.
--
-- The length constraint applies only to the full ARN. If you specify only
-- the function name, it is limited to 64 characters in length.
newDeleteFunctionUrlConfig ::
  -- | 'functionName'
  Prelude.Text ->
  DeleteFunctionUrlConfig
newDeleteFunctionUrlConfig :: Text -> DeleteFunctionUrlConfig
newDeleteFunctionUrlConfig Text
pFunctionName_ =
  DeleteFunctionUrlConfig'
    { $sel:qualifier:DeleteFunctionUrlConfig' :: Maybe Text
qualifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:functionName:DeleteFunctionUrlConfig' :: Text
functionName = Text
pFunctionName_
    }

-- | The alias name.
deleteFunctionUrlConfig_qualifier :: Lens.Lens' DeleteFunctionUrlConfig (Prelude.Maybe Prelude.Text)
deleteFunctionUrlConfig_qualifier :: Lens' DeleteFunctionUrlConfig (Maybe Text)
deleteFunctionUrlConfig_qualifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFunctionUrlConfig' {Maybe Text
qualifier :: Maybe Text
$sel:qualifier:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Maybe Text
qualifier} -> Maybe Text
qualifier) (\s :: DeleteFunctionUrlConfig
s@DeleteFunctionUrlConfig' {} Maybe Text
a -> DeleteFunctionUrlConfig
s {$sel:qualifier:DeleteFunctionUrlConfig' :: Maybe Text
qualifier = Maybe Text
a} :: DeleteFunctionUrlConfig)

-- | The name of the Lambda function.
--
-- __Name formats__
--
-- -   __Function name__ – @my-function@.
--
-- -   __Function ARN__ –
--     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
--
-- -   __Partial ARN__ – @123456789012:function:my-function@.
--
-- The length constraint applies only to the full ARN. If you specify only
-- the function name, it is limited to 64 characters in length.
deleteFunctionUrlConfig_functionName :: Lens.Lens' DeleteFunctionUrlConfig Prelude.Text
deleteFunctionUrlConfig_functionName :: Lens' DeleteFunctionUrlConfig Text
deleteFunctionUrlConfig_functionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFunctionUrlConfig' {Text
functionName :: Text
$sel:functionName:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Text
functionName} -> Text
functionName) (\s :: DeleteFunctionUrlConfig
s@DeleteFunctionUrlConfig' {} Text
a -> DeleteFunctionUrlConfig
s {$sel:functionName:DeleteFunctionUrlConfig' :: Text
functionName = Text
a} :: DeleteFunctionUrlConfig)

instance Core.AWSRequest DeleteFunctionUrlConfig where
  type
    AWSResponse DeleteFunctionUrlConfig =
      DeleteFunctionUrlConfigResponse
  request :: (Service -> Service)
-> DeleteFunctionUrlConfig -> Request DeleteFunctionUrlConfig
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 DeleteFunctionUrlConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFunctionUrlConfig)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteFunctionUrlConfigResponse
DeleteFunctionUrlConfigResponse'

instance Prelude.Hashable DeleteFunctionUrlConfig where
  hashWithSalt :: Int -> DeleteFunctionUrlConfig -> Int
hashWithSalt Int
_salt DeleteFunctionUrlConfig' {Maybe Text
Text
functionName :: Text
qualifier :: Maybe Text
$sel:functionName:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Text
$sel:qualifier:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
qualifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
functionName

instance Prelude.NFData DeleteFunctionUrlConfig where
  rnf :: DeleteFunctionUrlConfig -> ()
rnf DeleteFunctionUrlConfig' {Maybe Text
Text
functionName :: Text
qualifier :: Maybe Text
$sel:functionName:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Text
$sel:qualifier:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
qualifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
functionName

instance Data.ToHeaders DeleteFunctionUrlConfig where
  toHeaders :: DeleteFunctionUrlConfig -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DeleteFunctionUrlConfig where
  toPath :: DeleteFunctionUrlConfig -> ByteString
toPath DeleteFunctionUrlConfig' {Maybe Text
Text
functionName :: Text
qualifier :: Maybe Text
$sel:functionName:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Text
$sel:qualifier:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2021-10-31/functions/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
functionName,
        ByteString
"/url"
      ]

instance Data.ToQuery DeleteFunctionUrlConfig where
  toQuery :: DeleteFunctionUrlConfig -> QueryString
toQuery DeleteFunctionUrlConfig' {Maybe Text
Text
functionName :: Text
qualifier :: Maybe Text
$sel:functionName:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Text
$sel:qualifier:DeleteFunctionUrlConfig' :: DeleteFunctionUrlConfig -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"Qualifier" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
qualifier]

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

-- |
-- Create a value of 'DeleteFunctionUrlConfigResponse' 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.
newDeleteFunctionUrlConfigResponse ::
  DeleteFunctionUrlConfigResponse
newDeleteFunctionUrlConfigResponse :: DeleteFunctionUrlConfigResponse
newDeleteFunctionUrlConfigResponse =
  DeleteFunctionUrlConfigResponse
DeleteFunctionUrlConfigResponse'

instance
  Prelude.NFData
    DeleteFunctionUrlConfigResponse
  where
  rnf :: DeleteFunctionUrlConfigResponse -> ()
rnf DeleteFunctionUrlConfigResponse
_ = ()