{-# 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.FlushApiCache
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Flushes an @ApiCache@ object.
module Amazonka.AppSync.FlushApiCache
  ( -- * Creating a Request
    FlushApiCache (..),
    newFlushApiCache,

    -- * Request Lenses
    flushApiCache_apiId,

    -- * Destructuring the Response
    FlushApiCacheResponse (..),
    newFlushApiCacheResponse,

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

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

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

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

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

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

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

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

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

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

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