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

-- | The API ID.
deleteApiCache_apiId :: Lens.Lens' DeleteApiCache Prelude.Text
deleteApiCache_apiId :: (Text -> f Text) -> DeleteApiCache -> f DeleteApiCache
deleteApiCache_apiId = (DeleteApiCache -> Text)
-> (DeleteApiCache -> Text -> DeleteApiCache)
-> Lens DeleteApiCache DeleteApiCache Text Text
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 :: DeleteApiCache -> Request DeleteApiCache
request = Service -> DeleteApiCache -> Request DeleteApiCache
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteApiCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteApiCache)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteApiCache))
-> Logger
-> Service
-> Proxy DeleteApiCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteApiCache)))
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 -> DeleteApiCacheResponse
DeleteApiCacheResponse'
            (Int -> DeleteApiCacheResponse)
-> Either String Int -> Either String DeleteApiCacheResponse
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 DeleteApiCache

instance Prelude.NFData DeleteApiCache

instance Core.ToHeaders DeleteApiCache where
  toHeaders :: DeleteApiCache -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteApiCache -> 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 DeleteApiCache where
  toPath :: DeleteApiCache -> ByteString
toPath DeleteApiCache' {Text
apiId :: Text
$sel:apiId:DeleteApiCache' :: DeleteApiCache -> 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, ByteString
"/ApiCaches"]

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

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