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

-- | The API ID.
deleteGraphqlApi_apiId :: Lens.Lens' DeleteGraphqlApi Prelude.Text
deleteGraphqlApi_apiId :: (Text -> f Text) -> DeleteGraphqlApi -> f DeleteGraphqlApi
deleteGraphqlApi_apiId = (DeleteGraphqlApi -> Text)
-> (DeleteGraphqlApi -> Text -> DeleteGraphqlApi)
-> Lens DeleteGraphqlApi DeleteGraphqlApi Text Text
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 :: DeleteGraphqlApi -> Request DeleteGraphqlApi
request = Service -> DeleteGraphqlApi -> Request DeleteGraphqlApi
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteGraphqlApi)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteGraphqlApi))
-> Logger
-> Service
-> Proxy DeleteGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteGraphqlApi)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteGraphqlApiResponse
DeleteGraphqlApiResponse'
            (Int -> DeleteGraphqlApiResponse)
-> Either String Int -> Either String DeleteGraphqlApiResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteGraphqlApi

instance Prelude.NFData DeleteGraphqlApi

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

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

instance Core.ToQuery DeleteGraphqlApi where
  toQuery :: DeleteGraphqlApi -> QueryString
toQuery = QueryString -> DeleteGraphqlApi -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteGraphqlApiResponse -> DeleteGraphqlApiResponse -> Bool)
-> (DeleteGraphqlApiResponse -> DeleteGraphqlApiResponse -> Bool)
-> Eq DeleteGraphqlApiResponse
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]
(Int -> ReadS DeleteGraphqlApiResponse)
-> ReadS [DeleteGraphqlApiResponse]
-> ReadPrec DeleteGraphqlApiResponse
-> ReadPrec [DeleteGraphqlApiResponse]
-> Read 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
(Int -> DeleteGraphqlApiResponse -> ShowS)
-> (DeleteGraphqlApiResponse -> String)
-> ([DeleteGraphqlApiResponse] -> ShowS)
-> Show DeleteGraphqlApiResponse
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.
 DeleteGraphqlApiResponse -> Rep DeleteGraphqlApiResponse x)
-> (forall x.
    Rep DeleteGraphqlApiResponse x -> DeleteGraphqlApiResponse)
-> Generic DeleteGraphqlApiResponse
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' :: Int -> DeleteGraphqlApiResponse
DeleteGraphqlApiResponse'
    { $sel:httpStatus:DeleteGraphqlApiResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteGraphqlApiResponse_httpStatus :: Lens.Lens' DeleteGraphqlApiResponse Prelude.Int
deleteGraphqlApiResponse_httpStatus :: (Int -> f Int)
-> DeleteGraphqlApiResponse -> f DeleteGraphqlApiResponse
deleteGraphqlApiResponse_httpStatus = (DeleteGraphqlApiResponse -> Int)
-> (DeleteGraphqlApiResponse -> Int -> DeleteGraphqlApiResponse)
-> Lens DeleteGraphqlApiResponse DeleteGraphqlApiResponse Int Int
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