{-# 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-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)
--
-- 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.Lens as Lens
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'
  { -- | [Required] The string identifier of the associated RestApi.
    FlushStageCache -> Text
restApiId :: Prelude.Text,
    -- | [Required] The name of the stage to flush its cache.
    FlushStageCache -> Text
stageName :: Prelude.Text
  }
  deriving (FlushStageCache -> FlushStageCache -> Bool
(FlushStageCache -> FlushStageCache -> Bool)
-> (FlushStageCache -> FlushStageCache -> Bool)
-> Eq FlushStageCache
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]
(Int -> ReadS FlushStageCache)
-> ReadS [FlushStageCache]
-> ReadPrec FlushStageCache
-> ReadPrec [FlushStageCache]
-> Read 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
(Int -> FlushStageCache -> ShowS)
-> (FlushStageCache -> String)
-> ([FlushStageCache] -> ShowS)
-> Show FlushStageCache
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. FlushStageCache -> Rep FlushStageCache x)
-> (forall x. Rep FlushStageCache x -> FlushStageCache)
-> Generic FlushStageCache
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' - [Required] The string identifier of the associated RestApi.
--
-- 'stageName', 'flushStageCache_stageName' - [Required] 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' :: Text -> Text -> FlushStageCache
FlushStageCache'
    { $sel:restApiId:FlushStageCache' :: Text
restApiId = Text
pRestApiId_,
      $sel:stageName:FlushStageCache' :: Text
stageName = Text
pStageName_
    }

-- | [Required] The string identifier of the associated RestApi.
flushStageCache_restApiId :: Lens.Lens' FlushStageCache Prelude.Text
flushStageCache_restApiId :: (Text -> f Text) -> FlushStageCache -> f FlushStageCache
flushStageCache_restApiId = (FlushStageCache -> Text)
-> (FlushStageCache -> Text -> FlushStageCache)
-> Lens FlushStageCache FlushStageCache Text Text
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)

-- | [Required] The name of the stage to flush its cache.
flushStageCache_stageName :: Lens.Lens' FlushStageCache Prelude.Text
flushStageCache_stageName :: (Text -> f Text) -> FlushStageCache -> f FlushStageCache
flushStageCache_stageName = (FlushStageCache -> Text)
-> (FlushStageCache -> Text -> FlushStageCache)
-> Lens FlushStageCache FlushStageCache Text Text
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 :: FlushStageCache -> Request FlushStageCache
request = Service -> FlushStageCache -> Request FlushStageCache
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy FlushStageCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse FlushStageCache)))
response =
    AWSResponse FlushStageCache
-> Logger
-> Service
-> Proxy FlushStageCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse FlushStageCache)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse FlushStageCache
FlushStageCacheResponse
FlushStageCacheResponse'

instance Prelude.Hashable FlushStageCache

instance Prelude.NFData FlushStageCache

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

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

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

-- | /See:/ 'newFlushStageCacheResponse' smart constructor.
data FlushStageCacheResponse = FlushStageCacheResponse'
  {
  }
  deriving (FlushStageCacheResponse -> FlushStageCacheResponse -> Bool
(FlushStageCacheResponse -> FlushStageCacheResponse -> Bool)
-> (FlushStageCacheResponse -> FlushStageCacheResponse -> Bool)
-> Eq FlushStageCacheResponse
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]
(Int -> ReadS FlushStageCacheResponse)
-> ReadS [FlushStageCacheResponse]
-> ReadPrec FlushStageCacheResponse
-> ReadPrec [FlushStageCacheResponse]
-> Read 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
(Int -> FlushStageCacheResponse -> ShowS)
-> (FlushStageCacheResponse -> String)
-> ([FlushStageCacheResponse] -> ShowS)
-> Show FlushStageCacheResponse
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.
 FlushStageCacheResponse -> Rep FlushStageCacheResponse x)
-> (forall x.
    Rep FlushStageCacheResponse x -> FlushStageCacheResponse)
-> Generic FlushStageCacheResponse
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