{-# 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 #-}
module Amazonka.StorageGateway.ResetCache
(
ResetCache (..),
newResetCache,
resetCache_gatewayARN,
ResetCacheResponse (..),
newResetCacheResponse,
resetCacheResponse_gatewayARN,
resetCacheResponse_httpStatus,
)
where
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
import Amazonka.StorageGateway.Types
data ResetCache = ResetCache'
{ ResetCache -> Text
gatewayARN :: Prelude.Text
}
deriving (ResetCache -> ResetCache -> Bool
(ResetCache -> ResetCache -> Bool)
-> (ResetCache -> ResetCache -> Bool) -> Eq ResetCache
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetCache -> ResetCache -> Bool
$c/= :: ResetCache -> ResetCache -> Bool
== :: ResetCache -> ResetCache -> Bool
$c== :: ResetCache -> ResetCache -> Bool
Prelude.Eq, ReadPrec [ResetCache]
ReadPrec ResetCache
Int -> ReadS ResetCache
ReadS [ResetCache]
(Int -> ReadS ResetCache)
-> ReadS [ResetCache]
-> ReadPrec ResetCache
-> ReadPrec [ResetCache]
-> Read ResetCache
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetCache]
$creadListPrec :: ReadPrec [ResetCache]
readPrec :: ReadPrec ResetCache
$creadPrec :: ReadPrec ResetCache
readList :: ReadS [ResetCache]
$creadList :: ReadS [ResetCache]
readsPrec :: Int -> ReadS ResetCache
$creadsPrec :: Int -> ReadS ResetCache
Prelude.Read, Int -> ResetCache -> ShowS
[ResetCache] -> ShowS
ResetCache -> String
(Int -> ResetCache -> ShowS)
-> (ResetCache -> String)
-> ([ResetCache] -> ShowS)
-> Show ResetCache
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetCache] -> ShowS
$cshowList :: [ResetCache] -> ShowS
show :: ResetCache -> String
$cshow :: ResetCache -> String
showsPrec :: Int -> ResetCache -> ShowS
$cshowsPrec :: Int -> ResetCache -> ShowS
Prelude.Show, (forall x. ResetCache -> Rep ResetCache x)
-> (forall x. Rep ResetCache x -> ResetCache) -> Generic ResetCache
forall x. Rep ResetCache x -> ResetCache
forall x. ResetCache -> Rep ResetCache x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResetCache x -> ResetCache
$cfrom :: forall x. ResetCache -> Rep ResetCache x
Prelude.Generic)
newResetCache ::
Prelude.Text ->
ResetCache
newResetCache :: Text -> ResetCache
newResetCache Text
pGatewayARN_ =
ResetCache' :: Text -> ResetCache
ResetCache' {$sel:gatewayARN:ResetCache' :: Text
gatewayARN = Text
pGatewayARN_}
resetCache_gatewayARN :: Lens.Lens' ResetCache Prelude.Text
resetCache_gatewayARN :: (Text -> f Text) -> ResetCache -> f ResetCache
resetCache_gatewayARN = (ResetCache -> Text)
-> (ResetCache -> Text -> ResetCache)
-> Lens ResetCache ResetCache Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetCache' {Text
gatewayARN :: Text
$sel:gatewayARN:ResetCache' :: ResetCache -> Text
gatewayARN} -> Text
gatewayARN) (\s :: ResetCache
s@ResetCache' {} Text
a -> ResetCache
s {$sel:gatewayARN:ResetCache' :: Text
gatewayARN = Text
a} :: ResetCache)
instance Core.AWSRequest ResetCache where
type AWSResponse ResetCache = ResetCacheResponse
request :: ResetCache -> Request ResetCache
request = Service -> ResetCache -> Request ResetCache
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ResetCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetCache)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ResetCache))
-> Logger
-> Service
-> Proxy ResetCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetCache)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> ResetCacheResponse
ResetCacheResponse'
(Maybe Text -> Int -> ResetCacheResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ResetCacheResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GatewayARN")
Either String (Int -> ResetCacheResponse)
-> Either String Int -> Either String ResetCacheResponse
forall (f :: * -> *) a b. Applicative f => 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 ResetCache
instance Prelude.NFData ResetCache
instance Core.ToHeaders ResetCache where
toHeaders :: ResetCache -> ResponseHeaders
toHeaders =
ResponseHeaders -> ResetCache -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"StorageGateway_20130630.ResetCache" ::
Prelude.ByteString
),
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.ToJSON ResetCache where
toJSON :: ResetCache -> Value
toJSON ResetCache' {Text
gatewayARN :: Text
$sel:gatewayARN:ResetCache' :: ResetCache -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GatewayARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gatewayARN)]
)
instance Core.ToPath ResetCache where
toPath :: ResetCache -> ByteString
toPath = ByteString -> ResetCache -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ResetCache where
toQuery :: ResetCache -> QueryString
toQuery = QueryString -> ResetCache -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ResetCacheResponse = ResetCacheResponse'
{ ResetCacheResponse -> Maybe Text
gatewayARN :: Prelude.Maybe Prelude.Text,
ResetCacheResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResetCacheResponse -> ResetCacheResponse -> Bool
(ResetCacheResponse -> ResetCacheResponse -> Bool)
-> (ResetCacheResponse -> ResetCacheResponse -> Bool)
-> Eq ResetCacheResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetCacheResponse -> ResetCacheResponse -> Bool
$c/= :: ResetCacheResponse -> ResetCacheResponse -> Bool
== :: ResetCacheResponse -> ResetCacheResponse -> Bool
$c== :: ResetCacheResponse -> ResetCacheResponse -> Bool
Prelude.Eq, ReadPrec [ResetCacheResponse]
ReadPrec ResetCacheResponse
Int -> ReadS ResetCacheResponse
ReadS [ResetCacheResponse]
(Int -> ReadS ResetCacheResponse)
-> ReadS [ResetCacheResponse]
-> ReadPrec ResetCacheResponse
-> ReadPrec [ResetCacheResponse]
-> Read ResetCacheResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetCacheResponse]
$creadListPrec :: ReadPrec [ResetCacheResponse]
readPrec :: ReadPrec ResetCacheResponse
$creadPrec :: ReadPrec ResetCacheResponse
readList :: ReadS [ResetCacheResponse]
$creadList :: ReadS [ResetCacheResponse]
readsPrec :: Int -> ReadS ResetCacheResponse
$creadsPrec :: Int -> ReadS ResetCacheResponse
Prelude.Read, Int -> ResetCacheResponse -> ShowS
[ResetCacheResponse] -> ShowS
ResetCacheResponse -> String
(Int -> ResetCacheResponse -> ShowS)
-> (ResetCacheResponse -> String)
-> ([ResetCacheResponse] -> ShowS)
-> Show ResetCacheResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetCacheResponse] -> ShowS
$cshowList :: [ResetCacheResponse] -> ShowS
show :: ResetCacheResponse -> String
$cshow :: ResetCacheResponse -> String
showsPrec :: Int -> ResetCacheResponse -> ShowS
$cshowsPrec :: Int -> ResetCacheResponse -> ShowS
Prelude.Show, (forall x. ResetCacheResponse -> Rep ResetCacheResponse x)
-> (forall x. Rep ResetCacheResponse x -> ResetCacheResponse)
-> Generic ResetCacheResponse
forall x. Rep ResetCacheResponse x -> ResetCacheResponse
forall x. ResetCacheResponse -> Rep ResetCacheResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResetCacheResponse x -> ResetCacheResponse
$cfrom :: forall x. ResetCacheResponse -> Rep ResetCacheResponse x
Prelude.Generic)
newResetCacheResponse ::
Prelude.Int ->
ResetCacheResponse
newResetCacheResponse :: Int -> ResetCacheResponse
newResetCacheResponse Int
pHttpStatus_ =
ResetCacheResponse' :: Maybe Text -> Int -> ResetCacheResponse
ResetCacheResponse'
{ $sel:gatewayARN:ResetCacheResponse' :: Maybe Text
gatewayARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ResetCacheResponse' :: Int
httpStatus = Int
pHttpStatus_
}
resetCacheResponse_gatewayARN :: Lens.Lens' ResetCacheResponse (Prelude.Maybe Prelude.Text)
resetCacheResponse_gatewayARN :: (Maybe Text -> f (Maybe Text))
-> ResetCacheResponse -> f ResetCacheResponse
resetCacheResponse_gatewayARN = (ResetCacheResponse -> Maybe Text)
-> (ResetCacheResponse -> Maybe Text -> ResetCacheResponse)
-> Lens
ResetCacheResponse ResetCacheResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetCacheResponse' {Maybe Text
gatewayARN :: Maybe Text
$sel:gatewayARN:ResetCacheResponse' :: ResetCacheResponse -> Maybe Text
gatewayARN} -> Maybe Text
gatewayARN) (\s :: ResetCacheResponse
s@ResetCacheResponse' {} Maybe Text
a -> ResetCacheResponse
s {$sel:gatewayARN:ResetCacheResponse' :: Maybe Text
gatewayARN = Maybe Text
a} :: ResetCacheResponse)
resetCacheResponse_httpStatus :: Lens.Lens' ResetCacheResponse Prelude.Int
resetCacheResponse_httpStatus :: (Int -> f Int) -> ResetCacheResponse -> f ResetCacheResponse
resetCacheResponse_httpStatus = (ResetCacheResponse -> Int)
-> (ResetCacheResponse -> Int -> ResetCacheResponse)
-> Lens ResetCacheResponse ResetCacheResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetCacheResponse' {Int
httpStatus :: Int
$sel:httpStatus:ResetCacheResponse' :: ResetCacheResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ResetCacheResponse
s@ResetCacheResponse' {} Int
a -> ResetCacheResponse
s {$sel:httpStatus:ResetCacheResponse' :: Int
httpStatus = Int
a} :: ResetCacheResponse)
instance Prelude.NFData ResetCacheResponse