{-# 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.AppSync.DeleteGraphqlApi
-- 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 @GraphqlApi@ object.
module Amazonka.AppSync.DeleteGraphqlApi
  ( -- * Creating a Request
    DeleteGraphqlApi (..),
    newDeleteGraphqlApi,

    -- * Request Lenses
    deleteGraphqlApi_apiId,

    -- * Destructuring the Response
    DeleteGraphqlApiResponse (..),
    newDeleteGraphqlApiResponse,

    -- * Response Lenses
    deleteGraphqlApiResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'DeleteGraphqlApi' 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', 'deleteGraphqlApi_apiId' - The API ID.
newDeleteGraphqlApi ::
  -- | 'apiId'
  Prelude.Text ->
  DeleteGraphqlApi
newDeleteGraphqlApi :: Text -> DeleteGraphqlApi
newDeleteGraphqlApi Text
pApiId_ =
  DeleteGraphqlApi' {$sel:apiId:DeleteGraphqlApi' :: Text
apiId = Text
pApiId_}

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

instance Core.AWSRequest DeleteGraphqlApi where
  type
    AWSResponse DeleteGraphqlApi =
      DeleteGraphqlApiResponse
  request :: (Service -> Service)
-> DeleteGraphqlApi -> Request DeleteGraphqlApi
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 DeleteGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteGraphqlApi)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteGraphqlApiResponse
DeleteGraphqlApiResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

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

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

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

instance Data.ToPath DeleteGraphqlApi where
  toPath :: DeleteGraphqlApi -> ByteString
toPath DeleteGraphqlApi' {Text
apiId :: Text
$sel:apiId:DeleteGraphqlApi' :: DeleteGraphqlApi -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/v1/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId]

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

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

-- |
-- Create a value of 'DeleteGraphqlApiResponse' 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:
--
-- 'httpStatus', 'deleteGraphqlApiResponse_httpStatus' - The response's http status code.
newDeleteGraphqlApiResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteGraphqlApiResponse
newDeleteGraphqlApiResponse :: Int -> DeleteGraphqlApiResponse
newDeleteGraphqlApiResponse Int
pHttpStatus_ =
  DeleteGraphqlApiResponse'
    { $sel:httpStatus:DeleteGraphqlApiResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteGraphqlApiResponse_httpStatus :: Lens.Lens' DeleteGraphqlApiResponse Prelude.Int
deleteGraphqlApiResponse_httpStatus :: Lens' DeleteGraphqlApiResponse Int
deleteGraphqlApiResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGraphqlApiResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteGraphqlApiResponse' :: DeleteGraphqlApiResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteGraphqlApiResponse
s@DeleteGraphqlApiResponse' {} Int
a -> DeleteGraphqlApiResponse
s {$sel:httpStatus:DeleteGraphqlApiResponse' :: Int
httpStatus = Int
a} :: DeleteGraphqlApiResponse)

instance Prelude.NFData DeleteGraphqlApiResponse where
  rnf :: DeleteGraphqlApiResponse -> ()
rnf DeleteGraphqlApiResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteGraphqlApiResponse' :: DeleteGraphqlApiResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus