{-# 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.APIGateway.FlushStageCache
-- 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 a stage\'s cache.
module Amazonka.APIGateway.FlushStageCache
  ( -- * Creating a Request
    FlushStageCache (..),
    newFlushStageCache,

    -- * Request Lenses
    flushStageCache_restApiId,
    flushStageCache_stageName,

    -- * Destructuring the Response
    FlushStageCacheResponse (..),
    newFlushStageCacheResponse,
  )
where

import Amazonka.APIGateway.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

-- | Requests API Gateway to flush a stage\'s cache.
--
-- /See:/ 'newFlushStageCache' smart constructor.
data FlushStageCache = FlushStageCache'
  { -- | The string identifier of the associated RestApi.
    FlushStageCache -> Text
restApiId :: Prelude.Text,
    -- | The name of the stage to flush its cache.
    FlushStageCache -> Text
stageName :: Prelude.Text
  }
  deriving (FlushStageCache -> FlushStageCache -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlushStageCache -> FlushStageCache -> Bool
$c/= :: FlushStageCache -> FlushStageCache -> Bool
== :: FlushStageCache -> FlushStageCache -> Bool
$c== :: FlushStageCache -> FlushStageCache -> Bool
Prelude.Eq, ReadPrec [FlushStageCache]
ReadPrec FlushStageCache
Int -> ReadS FlushStageCache
ReadS [FlushStageCache]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlushStageCache]
$creadListPrec :: ReadPrec [FlushStageCache]
readPrec :: ReadPrec FlushStageCache
$creadPrec :: ReadPrec FlushStageCache
readList :: ReadS [FlushStageCache]
$creadList :: ReadS [FlushStageCache]
readsPrec :: Int -> ReadS FlushStageCache
$creadsPrec :: Int -> ReadS FlushStageCache
Prelude.Read, Int -> FlushStageCache -> ShowS
[FlushStageCache] -> ShowS
FlushStageCache -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlushStageCache] -> ShowS
$cshowList :: [FlushStageCache] -> ShowS
show :: FlushStageCache -> String
$cshow :: FlushStageCache -> String
showsPrec :: Int -> FlushStageCache -> ShowS
$cshowsPrec :: Int -> FlushStageCache -> ShowS
Prelude.Show, forall x. Rep FlushStageCache x -> FlushStageCache
forall x. FlushStageCache -> Rep FlushStageCache x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FlushStageCache x -> FlushStageCache
$cfrom :: forall x. FlushStageCache -> Rep FlushStageCache x
Prelude.Generic)

-- |
-- Create a value of 'FlushStageCache' 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:
--
-- 'restApiId', 'flushStageCache_restApiId' - The string identifier of the associated RestApi.
--
-- 'stageName', 'flushStageCache_stageName' - The name of the stage to flush its cache.
newFlushStageCache ::
  -- | 'restApiId'
  Prelude.Text ->
  -- | 'stageName'
  Prelude.Text ->
  FlushStageCache
newFlushStageCache :: Text -> Text -> FlushStageCache
newFlushStageCache Text
pRestApiId_ Text
pStageName_ =
  FlushStageCache'
    { $sel:restApiId:FlushStageCache' :: Text
restApiId = Text
pRestApiId_,
      $sel:stageName:FlushStageCache' :: Text
stageName = Text
pStageName_
    }

-- | The string identifier of the associated RestApi.
flushStageCache_restApiId :: Lens.Lens' FlushStageCache Prelude.Text
flushStageCache_restApiId :: Lens' FlushStageCache Text
flushStageCache_restApiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlushStageCache' {Text
restApiId :: Text
$sel:restApiId:FlushStageCache' :: FlushStageCache -> Text
restApiId} -> Text
restApiId) (\s :: FlushStageCache
s@FlushStageCache' {} Text
a -> FlushStageCache
s {$sel:restApiId:FlushStageCache' :: Text
restApiId = Text
a} :: FlushStageCache)

-- | The name of the stage to flush its cache.
flushStageCache_stageName :: Lens.Lens' FlushStageCache Prelude.Text
flushStageCache_stageName :: Lens' FlushStageCache Text
flushStageCache_stageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlushStageCache' {Text
stageName :: Text
$sel:stageName:FlushStageCache' :: FlushStageCache -> Text
stageName} -> Text
stageName) (\s :: FlushStageCache
s@FlushStageCache' {} Text
a -> FlushStageCache
s {$sel:stageName:FlushStageCache' :: Text
stageName = Text
a} :: FlushStageCache)

instance Core.AWSRequest FlushStageCache where
  type
    AWSResponse FlushStageCache =
      FlushStageCacheResponse
  request :: (Service -> Service) -> FlushStageCache -> Request FlushStageCache
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 FlushStageCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse FlushStageCache)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull FlushStageCacheResponse
FlushStageCacheResponse'

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

instance Prelude.NFData FlushStageCache where
  rnf :: FlushStageCache -> ()
rnf FlushStageCache' {Text
stageName :: Text
restApiId :: Text
$sel:stageName:FlushStageCache' :: FlushStageCache -> Text
$sel:restApiId:FlushStageCache' :: FlushStageCache -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
restApiId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stageName

instance Data.ToHeaders FlushStageCache where
  toHeaders :: FlushStageCache -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

instance Data.ToPath FlushStageCache where
  toPath :: FlushStageCache -> ByteString
toPath FlushStageCache' {Text
stageName :: Text
restApiId :: Text
$sel:stageName:FlushStageCache' :: FlushStageCache -> Text
$sel:restApiId:FlushStageCache' :: FlushStageCache -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/restapis/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
restApiId,
        ByteString
"/stages/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
stageName,
        ByteString
"/cache/data"
      ]

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

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

-- |
-- Create a value of 'FlushStageCacheResponse' 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.
newFlushStageCacheResponse ::
  FlushStageCacheResponse
newFlushStageCacheResponse :: FlushStageCacheResponse
newFlushStageCacheResponse = FlushStageCacheResponse
FlushStageCacheResponse'

instance Prelude.NFData FlushStageCacheResponse where
  rnf :: FlushStageCacheResponse -> ()
rnf FlushStageCacheResponse
_ = ()