{-# 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.DeleteApi
-- 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 resource.
module Amazonka.ApiGatewayV2.DeleteApi
  ( -- * Creating a Request
    DeleteApi (..),
    newDeleteApi,

    -- * Request Lenses
    deleteApi_apiId,

    -- * Destructuring the Response
    DeleteApiResponse (..),
    newDeleteApiResponse,
  )
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:/ 'newDeleteApi' smart constructor.
data DeleteApi = DeleteApi'
  { -- | The API identifier.
    DeleteApi -> Text
apiId :: Prelude.Text
  }
  deriving (DeleteApi -> DeleteApi -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteApi -> DeleteApi -> Bool
$c/= :: DeleteApi -> DeleteApi -> Bool
== :: DeleteApi -> DeleteApi -> Bool
$c== :: DeleteApi -> DeleteApi -> Bool
Prelude.Eq, ReadPrec [DeleteApi]
ReadPrec DeleteApi
Int -> ReadS DeleteApi
ReadS [DeleteApi]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteApi]
$creadListPrec :: ReadPrec [DeleteApi]
readPrec :: ReadPrec DeleteApi
$creadPrec :: ReadPrec DeleteApi
readList :: ReadS [DeleteApi]
$creadList :: ReadS [DeleteApi]
readsPrec :: Int -> ReadS DeleteApi
$creadsPrec :: Int -> ReadS DeleteApi
Prelude.Read, Int -> DeleteApi -> ShowS
[DeleteApi] -> ShowS
DeleteApi -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteApi] -> ShowS
$cshowList :: [DeleteApi] -> ShowS
show :: DeleteApi -> String
$cshow :: DeleteApi -> String
showsPrec :: Int -> DeleteApi -> ShowS
$cshowsPrec :: Int -> DeleteApi -> ShowS
Prelude.Show, forall x. Rep DeleteApi x -> DeleteApi
forall x. DeleteApi -> Rep DeleteApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteApi x -> DeleteApi
$cfrom :: forall x. DeleteApi -> Rep DeleteApi x
Prelude.Generic)

-- |
-- Create a value of 'DeleteApi' 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:
--
-- 'apiId', 'deleteApi_apiId' - The API identifier.
newDeleteApi ::
  -- | 'apiId'
  Prelude.Text ->
  DeleteApi
newDeleteApi :: Text -> DeleteApi
newDeleteApi Text
pApiId_ = DeleteApi' {$sel:apiId:DeleteApi' :: Text
apiId = Text
pApiId_}

-- | The API identifier.
deleteApi_apiId :: Lens.Lens' DeleteApi Prelude.Text
deleteApi_apiId :: Lens' DeleteApi Text
deleteApi_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApi' {Text
apiId :: Text
$sel:apiId:DeleteApi' :: DeleteApi -> Text
apiId} -> Text
apiId) (\s :: DeleteApi
s@DeleteApi' {} Text
a -> DeleteApi
s {$sel:apiId:DeleteApi' :: Text
apiId = Text
a} :: DeleteApi)

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

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

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

instance Data.ToHeaders DeleteApi where
  toHeaders :: DeleteApi -> [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 DeleteApi where
  toPath :: DeleteApi -> ByteString
toPath DeleteApi' {Text
apiId :: Text
$sel:apiId:DeleteApi' :: DeleteApi -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/v2/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId]

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

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

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

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