{-# 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.RefreshCache
(
RefreshCache (..),
newRefreshCache,
refreshCache_folderList,
refreshCache_recursive,
refreshCache_fileShareARN,
RefreshCacheResponse (..),
newRefreshCacheResponse,
refreshCacheResponse_fileShareARN,
refreshCacheResponse_notificationId,
refreshCacheResponse_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 RefreshCache = RefreshCache'
{
RefreshCache -> Maybe (NonEmpty Text)
folderList :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
RefreshCache -> Maybe Bool
recursive :: Prelude.Maybe Prelude.Bool,
RefreshCache -> Text
fileShareARN :: Prelude.Text
}
deriving (RefreshCache -> RefreshCache -> Bool
(RefreshCache -> RefreshCache -> Bool)
-> (RefreshCache -> RefreshCache -> Bool) -> Eq RefreshCache
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefreshCache -> RefreshCache -> Bool
$c/= :: RefreshCache -> RefreshCache -> Bool
== :: RefreshCache -> RefreshCache -> Bool
$c== :: RefreshCache -> RefreshCache -> Bool
Prelude.Eq, ReadPrec [RefreshCache]
ReadPrec RefreshCache
Int -> ReadS RefreshCache
ReadS [RefreshCache]
(Int -> ReadS RefreshCache)
-> ReadS [RefreshCache]
-> ReadPrec RefreshCache
-> ReadPrec [RefreshCache]
-> Read RefreshCache
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RefreshCache]
$creadListPrec :: ReadPrec [RefreshCache]
readPrec :: ReadPrec RefreshCache
$creadPrec :: ReadPrec RefreshCache
readList :: ReadS [RefreshCache]
$creadList :: ReadS [RefreshCache]
readsPrec :: Int -> ReadS RefreshCache
$creadsPrec :: Int -> ReadS RefreshCache
Prelude.Read, Int -> RefreshCache -> ShowS
[RefreshCache] -> ShowS
RefreshCache -> String
(Int -> RefreshCache -> ShowS)
-> (RefreshCache -> String)
-> ([RefreshCache] -> ShowS)
-> Show RefreshCache
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RefreshCache] -> ShowS
$cshowList :: [RefreshCache] -> ShowS
show :: RefreshCache -> String
$cshow :: RefreshCache -> String
showsPrec :: Int -> RefreshCache -> ShowS
$cshowsPrec :: Int -> RefreshCache -> ShowS
Prelude.Show, (forall x. RefreshCache -> Rep RefreshCache x)
-> (forall x. Rep RefreshCache x -> RefreshCache)
-> Generic RefreshCache
forall x. Rep RefreshCache x -> RefreshCache
forall x. RefreshCache -> Rep RefreshCache x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RefreshCache x -> RefreshCache
$cfrom :: forall x. RefreshCache -> Rep RefreshCache x
Prelude.Generic)
newRefreshCache ::
Prelude.Text ->
RefreshCache
newRefreshCache :: Text -> RefreshCache
newRefreshCache Text
pFileShareARN_ =
RefreshCache' :: Maybe (NonEmpty Text) -> Maybe Bool -> Text -> RefreshCache
RefreshCache'
{ $sel:folderList:RefreshCache' :: Maybe (NonEmpty Text)
folderList = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:recursive:RefreshCache' :: Maybe Bool
recursive = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:fileShareARN:RefreshCache' :: Text
fileShareARN = Text
pFileShareARN_
}
refreshCache_folderList :: Lens.Lens' RefreshCache (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
refreshCache_folderList :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> RefreshCache -> f RefreshCache
refreshCache_folderList = (RefreshCache -> Maybe (NonEmpty Text))
-> (RefreshCache -> Maybe (NonEmpty Text) -> RefreshCache)
-> Lens
RefreshCache
RefreshCache
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshCache' {Maybe (NonEmpty Text)
folderList :: Maybe (NonEmpty Text)
$sel:folderList:RefreshCache' :: RefreshCache -> Maybe (NonEmpty Text)
folderList} -> Maybe (NonEmpty Text)
folderList) (\s :: RefreshCache
s@RefreshCache' {} Maybe (NonEmpty Text)
a -> RefreshCache
s {$sel:folderList:RefreshCache' :: Maybe (NonEmpty Text)
folderList = Maybe (NonEmpty Text)
a} :: RefreshCache) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> RefreshCache -> f RefreshCache)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> RefreshCache
-> f RefreshCache
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
refreshCache_recursive :: Lens.Lens' RefreshCache (Prelude.Maybe Prelude.Bool)
refreshCache_recursive :: (Maybe Bool -> f (Maybe Bool)) -> RefreshCache -> f RefreshCache
refreshCache_recursive = (RefreshCache -> Maybe Bool)
-> (RefreshCache -> Maybe Bool -> RefreshCache)
-> Lens RefreshCache RefreshCache (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshCache' {Maybe Bool
recursive :: Maybe Bool
$sel:recursive:RefreshCache' :: RefreshCache -> Maybe Bool
recursive} -> Maybe Bool
recursive) (\s :: RefreshCache
s@RefreshCache' {} Maybe Bool
a -> RefreshCache
s {$sel:recursive:RefreshCache' :: Maybe Bool
recursive = Maybe Bool
a} :: RefreshCache)
refreshCache_fileShareARN :: Lens.Lens' RefreshCache Prelude.Text
refreshCache_fileShareARN :: (Text -> f Text) -> RefreshCache -> f RefreshCache
refreshCache_fileShareARN = (RefreshCache -> Text)
-> (RefreshCache -> Text -> RefreshCache)
-> Lens RefreshCache RefreshCache Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshCache' {Text
fileShareARN :: Text
$sel:fileShareARN:RefreshCache' :: RefreshCache -> Text
fileShareARN} -> Text
fileShareARN) (\s :: RefreshCache
s@RefreshCache' {} Text
a -> RefreshCache
s {$sel:fileShareARN:RefreshCache' :: Text
fileShareARN = Text
a} :: RefreshCache)
instance Core.AWSRequest RefreshCache where
type AWSResponse RefreshCache = RefreshCacheResponse
request :: RefreshCache -> Request RefreshCache
request = Service -> RefreshCache -> Request RefreshCache
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RefreshCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RefreshCache)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RefreshCache))
-> Logger
-> Service
-> Proxy RefreshCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RefreshCache)))
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 -> Maybe Text -> Int -> RefreshCacheResponse
RefreshCacheResponse'
(Maybe Text -> Maybe Text -> Int -> RefreshCacheResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> RefreshCacheResponse)
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
"FileShareARN")
Either String (Maybe Text -> Int -> RefreshCacheResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RefreshCacheResponse)
forall (f :: * -> *) a b. Applicative f => 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
"NotificationId")
Either String (Int -> RefreshCacheResponse)
-> Either String Int -> Either String RefreshCacheResponse
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 RefreshCache
instance Prelude.NFData RefreshCache
instance Core.ToHeaders RefreshCache where
toHeaders :: RefreshCache -> ResponseHeaders
toHeaders =
ResponseHeaders -> RefreshCache -> 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.RefreshCache" ::
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 RefreshCache where
toJSON :: RefreshCache -> Value
toJSON RefreshCache' {Maybe Bool
Maybe (NonEmpty Text)
Text
fileShareARN :: Text
recursive :: Maybe Bool
folderList :: Maybe (NonEmpty Text)
$sel:fileShareARN:RefreshCache' :: RefreshCache -> Text
$sel:recursive:RefreshCache' :: RefreshCache -> Maybe Bool
$sel:folderList:RefreshCache' :: RefreshCache -> Maybe (NonEmpty Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"FolderList" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
folderList,
(Text
"Recursive" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
recursive,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FileShareARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fileShareARN)
]
)
instance Core.ToPath RefreshCache where
toPath :: RefreshCache -> ByteString
toPath = ByteString -> RefreshCache -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RefreshCache where
toQuery :: RefreshCache -> QueryString
toQuery = QueryString -> RefreshCache -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RefreshCacheResponse = RefreshCacheResponse'
{ RefreshCacheResponse -> Maybe Text
fileShareARN :: Prelude.Maybe Prelude.Text,
RefreshCacheResponse -> Maybe Text
notificationId :: Prelude.Maybe Prelude.Text,
RefreshCacheResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RefreshCacheResponse -> RefreshCacheResponse -> Bool
(RefreshCacheResponse -> RefreshCacheResponse -> Bool)
-> (RefreshCacheResponse -> RefreshCacheResponse -> Bool)
-> Eq RefreshCacheResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefreshCacheResponse -> RefreshCacheResponse -> Bool
$c/= :: RefreshCacheResponse -> RefreshCacheResponse -> Bool
== :: RefreshCacheResponse -> RefreshCacheResponse -> Bool
$c== :: RefreshCacheResponse -> RefreshCacheResponse -> Bool
Prelude.Eq, ReadPrec [RefreshCacheResponse]
ReadPrec RefreshCacheResponse
Int -> ReadS RefreshCacheResponse
ReadS [RefreshCacheResponse]
(Int -> ReadS RefreshCacheResponse)
-> ReadS [RefreshCacheResponse]
-> ReadPrec RefreshCacheResponse
-> ReadPrec [RefreshCacheResponse]
-> Read RefreshCacheResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RefreshCacheResponse]
$creadListPrec :: ReadPrec [RefreshCacheResponse]
readPrec :: ReadPrec RefreshCacheResponse
$creadPrec :: ReadPrec RefreshCacheResponse
readList :: ReadS [RefreshCacheResponse]
$creadList :: ReadS [RefreshCacheResponse]
readsPrec :: Int -> ReadS RefreshCacheResponse
$creadsPrec :: Int -> ReadS RefreshCacheResponse
Prelude.Read, Int -> RefreshCacheResponse -> ShowS
[RefreshCacheResponse] -> ShowS
RefreshCacheResponse -> String
(Int -> RefreshCacheResponse -> ShowS)
-> (RefreshCacheResponse -> String)
-> ([RefreshCacheResponse] -> ShowS)
-> Show RefreshCacheResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RefreshCacheResponse] -> ShowS
$cshowList :: [RefreshCacheResponse] -> ShowS
show :: RefreshCacheResponse -> String
$cshow :: RefreshCacheResponse -> String
showsPrec :: Int -> RefreshCacheResponse -> ShowS
$cshowsPrec :: Int -> RefreshCacheResponse -> ShowS
Prelude.Show, (forall x. RefreshCacheResponse -> Rep RefreshCacheResponse x)
-> (forall x. Rep RefreshCacheResponse x -> RefreshCacheResponse)
-> Generic RefreshCacheResponse
forall x. Rep RefreshCacheResponse x -> RefreshCacheResponse
forall x. RefreshCacheResponse -> Rep RefreshCacheResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RefreshCacheResponse x -> RefreshCacheResponse
$cfrom :: forall x. RefreshCacheResponse -> Rep RefreshCacheResponse x
Prelude.Generic)
newRefreshCacheResponse ::
Prelude.Int ->
RefreshCacheResponse
newRefreshCacheResponse :: Int -> RefreshCacheResponse
newRefreshCacheResponse Int
pHttpStatus_ =
RefreshCacheResponse' :: Maybe Text -> Maybe Text -> Int -> RefreshCacheResponse
RefreshCacheResponse'
{ $sel:fileShareARN:RefreshCacheResponse' :: Maybe Text
fileShareARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:notificationId:RefreshCacheResponse' :: Maybe Text
notificationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RefreshCacheResponse' :: Int
httpStatus = Int
pHttpStatus_
}
refreshCacheResponse_fileShareARN :: Lens.Lens' RefreshCacheResponse (Prelude.Maybe Prelude.Text)
refreshCacheResponse_fileShareARN :: (Maybe Text -> f (Maybe Text))
-> RefreshCacheResponse -> f RefreshCacheResponse
refreshCacheResponse_fileShareARN = (RefreshCacheResponse -> Maybe Text)
-> (RefreshCacheResponse -> Maybe Text -> RefreshCacheResponse)
-> Lens
RefreshCacheResponse RefreshCacheResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshCacheResponse' {Maybe Text
fileShareARN :: Maybe Text
$sel:fileShareARN:RefreshCacheResponse' :: RefreshCacheResponse -> Maybe Text
fileShareARN} -> Maybe Text
fileShareARN) (\s :: RefreshCacheResponse
s@RefreshCacheResponse' {} Maybe Text
a -> RefreshCacheResponse
s {$sel:fileShareARN:RefreshCacheResponse' :: Maybe Text
fileShareARN = Maybe Text
a} :: RefreshCacheResponse)
refreshCacheResponse_notificationId :: Lens.Lens' RefreshCacheResponse (Prelude.Maybe Prelude.Text)
refreshCacheResponse_notificationId :: (Maybe Text -> f (Maybe Text))
-> RefreshCacheResponse -> f RefreshCacheResponse
refreshCacheResponse_notificationId = (RefreshCacheResponse -> Maybe Text)
-> (RefreshCacheResponse -> Maybe Text -> RefreshCacheResponse)
-> Lens
RefreshCacheResponse RefreshCacheResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshCacheResponse' {Maybe Text
notificationId :: Maybe Text
$sel:notificationId:RefreshCacheResponse' :: RefreshCacheResponse -> Maybe Text
notificationId} -> Maybe Text
notificationId) (\s :: RefreshCacheResponse
s@RefreshCacheResponse' {} Maybe Text
a -> RefreshCacheResponse
s {$sel:notificationId:RefreshCacheResponse' :: Maybe Text
notificationId = Maybe Text
a} :: RefreshCacheResponse)
refreshCacheResponse_httpStatus :: Lens.Lens' RefreshCacheResponse Prelude.Int
refreshCacheResponse_httpStatus :: (Int -> f Int) -> RefreshCacheResponse -> f RefreshCacheResponse
refreshCacheResponse_httpStatus = (RefreshCacheResponse -> Int)
-> (RefreshCacheResponse -> Int -> RefreshCacheResponse)
-> Lens RefreshCacheResponse RefreshCacheResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshCacheResponse' {Int
httpStatus :: Int
$sel:httpStatus:RefreshCacheResponse' :: RefreshCacheResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RefreshCacheResponse
s@RefreshCacheResponse' {} Int
a -> RefreshCacheResponse
s {$sel:httpStatus:RefreshCacheResponse' :: Int
httpStatus = Int
a} :: RefreshCacheResponse)
instance Prelude.NFData RefreshCacheResponse