{-# 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-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 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.Lens as Lens
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
(DeleteApiMapping -> DeleteApiMapping -> Bool)
-> (DeleteApiMapping -> DeleteApiMapping -> Bool)
-> Eq DeleteApiMapping
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]
(Int -> ReadS DeleteApiMapping)
-> ReadS [DeleteApiMapping]
-> ReadPrec DeleteApiMapping
-> ReadPrec [DeleteApiMapping]
-> Read 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
(Int -> DeleteApiMapping -> ShowS)
-> (DeleteApiMapping -> String)
-> ([DeleteApiMapping] -> ShowS)
-> Show DeleteApiMapping
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. DeleteApiMapping -> Rep DeleteApiMapping x)
-> (forall x. Rep DeleteApiMapping x -> DeleteApiMapping)
-> Generic DeleteApiMapping
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' :: Text -> Text -> DeleteApiMapping
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 :: (Text -> f Text) -> DeleteApiMapping -> f DeleteApiMapping
deleteApiMapping_apiMappingId = (DeleteApiMapping -> Text)
-> (DeleteApiMapping -> Text -> DeleteApiMapping)
-> Lens DeleteApiMapping DeleteApiMapping Text Text
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 :: (Text -> f Text) -> DeleteApiMapping -> f DeleteApiMapping
deleteApiMapping_domainName = (DeleteApiMapping -> Text)
-> (DeleteApiMapping -> Text -> DeleteApiMapping)
-> Lens DeleteApiMapping DeleteApiMapping Text Text
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 :: DeleteApiMapping -> Request DeleteApiMapping
request = Service -> DeleteApiMapping -> Request DeleteApiMapping
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteApiMapping
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteApiMapping)))
response =
    AWSResponse DeleteApiMapping
-> Logger
-> Service
-> Proxy DeleteApiMapping
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteApiMapping)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteApiMapping
DeleteApiMappingResponse
DeleteApiMappingResponse'

instance Prelude.Hashable DeleteApiMapping

instance Prelude.NFData DeleteApiMapping

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

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

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

-- | /See:/ 'newDeleteApiMappingResponse' smart constructor.
data DeleteApiMappingResponse = DeleteApiMappingResponse'
  {
  }
  deriving (DeleteApiMappingResponse -> DeleteApiMappingResponse -> Bool
(DeleteApiMappingResponse -> DeleteApiMappingResponse -> Bool)
-> (DeleteApiMappingResponse -> DeleteApiMappingResponse -> Bool)
-> Eq DeleteApiMappingResponse
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]
(Int -> ReadS DeleteApiMappingResponse)
-> ReadS [DeleteApiMappingResponse]
-> ReadPrec DeleteApiMappingResponse
-> ReadPrec [DeleteApiMappingResponse]
-> Read 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
(Int -> DeleteApiMappingResponse -> ShowS)
-> (DeleteApiMappingResponse -> String)
-> ([DeleteApiMappingResponse] -> ShowS)
-> Show DeleteApiMappingResponse
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.
 DeleteApiMappingResponse -> Rep DeleteApiMappingResponse x)
-> (forall x.
    Rep DeleteApiMappingResponse x -> DeleteApiMappingResponse)
-> Generic DeleteApiMappingResponse
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