{-# 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-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 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.Lens as Lens
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
(DeleteApi -> DeleteApi -> Bool)
-> (DeleteApi -> DeleteApi -> Bool) -> Eq DeleteApi
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]
(Int -> ReadS DeleteApi)
-> ReadS [DeleteApi]
-> ReadPrec DeleteApi
-> ReadPrec [DeleteApi]
-> Read 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
(Int -> DeleteApi -> ShowS)
-> (DeleteApi -> String)
-> ([DeleteApi] -> ShowS)
-> Show DeleteApi
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. DeleteApi -> Rep DeleteApi x)
-> (forall x. Rep DeleteApi x -> DeleteApi) -> Generic DeleteApi
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' :: Text -> DeleteApi
DeleteApi' {$sel:apiId:DeleteApi' :: Text
apiId = Text
pApiId_}

-- | The API identifier.
deleteApi_apiId :: Lens.Lens' DeleteApi Prelude.Text
deleteApi_apiId :: (Text -> f Text) -> DeleteApi -> f DeleteApi
deleteApi_apiId = (DeleteApi -> Text)
-> (DeleteApi -> Text -> DeleteApi)
-> Lens DeleteApi DeleteApi Text Text
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 :: DeleteApi -> Request DeleteApi
request = Service -> DeleteApi -> Request DeleteApi
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteApi)))
response = AWSResponse DeleteApi
-> Logger
-> Service
-> Proxy DeleteApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteApi)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteApi
DeleteApiResponse
DeleteApiResponse'

instance Prelude.Hashable DeleteApi

instance Prelude.NFData DeleteApi

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

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

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