{-# 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.DeleteApiCache
-- 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 @ApiCache@ object.
module Amazonka.AppSync.DeleteApiCache
  ( -- * Creating a Request
    DeleteApiCache (..),
    newDeleteApiCache,

    -- * Request Lenses
    deleteApiCache_apiId,

    -- * Destructuring the Response
    DeleteApiCacheResponse (..),
    newDeleteApiCacheResponse,

    -- * Response Lenses
    deleteApiCacheResponse_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

-- | Represents the input of a @DeleteApiCache@ operation.
--
-- /See:/ 'newDeleteApiCache' smart constructor.
data DeleteApiCache = DeleteApiCache'
  { -- | The API ID.
    DeleteApiCache -> Text
apiId :: Prelude.Text
  }
  deriving (DeleteApiCache -> DeleteApiCache -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteApiCache -> DeleteApiCache -> Bool
$c/= :: DeleteApiCache -> DeleteApiCache -> Bool
== :: DeleteApiCache -> DeleteApiCache -> Bool
$c== :: DeleteApiCache -> DeleteApiCache -> Bool
Prelude.Eq, ReadPrec [DeleteApiCache]
ReadPrec DeleteApiCache
Int -> ReadS DeleteApiCache
ReadS [DeleteApiCache]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteApiCache]
$creadListPrec :: ReadPrec [DeleteApiCache]
readPrec :: ReadPrec DeleteApiCache
$creadPrec :: ReadPrec DeleteApiCache
readList :: ReadS [DeleteApiCache]
$creadList :: ReadS [DeleteApiCache]
readsPrec :: Int -> ReadS DeleteApiCache
$creadsPrec :: Int -> ReadS DeleteApiCache
Prelude.Read, Int -> DeleteApiCache -> ShowS
[DeleteApiCache] -> ShowS
DeleteApiCache -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteApiCache] -> ShowS
$cshowList :: [DeleteApiCache] -> ShowS
show :: DeleteApiCache -> String
$cshow :: DeleteApiCache -> String
showsPrec :: Int -> DeleteApiCache -> ShowS
$cshowsPrec :: Int -> DeleteApiCache -> ShowS
Prelude.Show, forall x. Rep DeleteApiCache x -> DeleteApiCache
forall x. DeleteApiCache -> Rep DeleteApiCache x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteApiCache x -> DeleteApiCache
$cfrom :: forall x. DeleteApiCache -> Rep DeleteApiCache x
Prelude.Generic)

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

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

instance Core.AWSRequest DeleteApiCache where
  type
    AWSResponse DeleteApiCache =
      DeleteApiCacheResponse
  request :: (Service -> Service) -> DeleteApiCache -> Request DeleteApiCache
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 DeleteApiCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteApiCache)))
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 -> DeleteApiCacheResponse
DeleteApiCacheResponse'
            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 DeleteApiCache where
  hashWithSalt :: Int -> DeleteApiCache -> Int
hashWithSalt Int
_salt DeleteApiCache' {Text
apiId :: Text
$sel:apiId:DeleteApiCache' :: DeleteApiCache -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId

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

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

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

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

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

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

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