{-# 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.ApiGatewayV2.DeleteApiMapping
-- 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 an API mapping.
module Amazonka.ApiGatewayV2.DeleteApiMapping
  ( -- * Creating a Request
    DeleteApiMapping (..),
    newDeleteApiMapping,

    -- * Request Lenses
    deleteApiMapping_apiMappingId,
    deleteApiMapping_domainName,

    -- * Destructuring the Response
    DeleteApiMappingResponse (..),
    newDeleteApiMappingResponse,
  )
where

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

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

-- |
-- Create a value of 'DeleteApiMapping' 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:
--
-- 'apiMappingId', 'deleteApiMapping_apiMappingId' - The API mapping identifier.
--
-- 'domainName', 'deleteApiMapping_domainName' - The domain name.
newDeleteApiMapping ::
  -- | 'apiMappingId'
  Prelude.Text ->
  -- | 'domainName'
  Prelude.Text ->
  DeleteApiMapping
newDeleteApiMapping :: Text -> Text -> DeleteApiMapping
newDeleteApiMapping Text
pApiMappingId_ Text
pDomainName_ =
  DeleteApiMapping'
    { $sel:apiMappingId:DeleteApiMapping' :: Text
apiMappingId = Text
pApiMappingId_,
      $sel:domainName:DeleteApiMapping' :: Text
domainName = Text
pDomainName_
    }

-- | The API mapping identifier.
deleteApiMapping_apiMappingId :: Lens.Lens' DeleteApiMapping Prelude.Text
deleteApiMapping_apiMappingId :: Lens' DeleteApiMapping Text
deleteApiMapping_apiMappingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApiMapping' {Text
apiMappingId :: Text
$sel:apiMappingId:DeleteApiMapping' :: DeleteApiMapping -> Text
apiMappingId} -> Text
apiMappingId) (\s :: DeleteApiMapping
s@DeleteApiMapping' {} Text
a -> DeleteApiMapping
s {$sel:apiMappingId:DeleteApiMapping' :: Text
apiMappingId = Text
a} :: DeleteApiMapping)

-- | The domain name.
deleteApiMapping_domainName :: Lens.Lens' DeleteApiMapping Prelude.Text
deleteApiMapping_domainName :: Lens' DeleteApiMapping Text
deleteApiMapping_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApiMapping' {Text
domainName :: Text
$sel:domainName:DeleteApiMapping' :: DeleteApiMapping -> Text
domainName} -> Text
domainName) (\s :: DeleteApiMapping
s@DeleteApiMapping' {} Text
a -> DeleteApiMapping
s {$sel:domainName:DeleteApiMapping' :: Text
domainName = Text
a} :: DeleteApiMapping)

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

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

instance Prelude.NFData DeleteApiMapping where
  rnf :: DeleteApiMapping -> ()
rnf DeleteApiMapping' {Text
domainName :: Text
apiMappingId :: Text
$sel:domainName:DeleteApiMapping' :: DeleteApiMapping -> Text
$sel:apiMappingId:DeleteApiMapping' :: DeleteApiMapping -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
apiMappingId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainName

instance Data.ToHeaders DeleteApiMapping where
  toHeaders :: DeleteApiMapping -> [Header]
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 -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteApiMapping where
  toPath :: DeleteApiMapping -> ByteString
toPath DeleteApiMapping' {Text
domainName :: Text
apiMappingId :: Text
$sel:domainName:DeleteApiMapping' :: DeleteApiMapping -> Text
$sel:apiMappingId:DeleteApiMapping' :: DeleteApiMapping -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/domainnames/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainName,
        ByteString
"/apimappings/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiMappingId
      ]

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

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

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

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