{-# 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.NotifyWhenUploaded
(
NotifyWhenUploaded (..),
newNotifyWhenUploaded,
notifyWhenUploaded_fileShareARN,
NotifyWhenUploadedResponse (..),
newNotifyWhenUploadedResponse,
notifyWhenUploadedResponse_fileShareARN,
notifyWhenUploadedResponse_notificationId,
notifyWhenUploadedResponse_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 NotifyWhenUploaded = NotifyWhenUploaded'
{ NotifyWhenUploaded -> Text
fileShareARN :: Prelude.Text
}
deriving (NotifyWhenUploaded -> NotifyWhenUploaded -> Bool
(NotifyWhenUploaded -> NotifyWhenUploaded -> Bool)
-> (NotifyWhenUploaded -> NotifyWhenUploaded -> Bool)
-> Eq NotifyWhenUploaded
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotifyWhenUploaded -> NotifyWhenUploaded -> Bool
$c/= :: NotifyWhenUploaded -> NotifyWhenUploaded -> Bool
== :: NotifyWhenUploaded -> NotifyWhenUploaded -> Bool
$c== :: NotifyWhenUploaded -> NotifyWhenUploaded -> Bool
Prelude.Eq, ReadPrec [NotifyWhenUploaded]
ReadPrec NotifyWhenUploaded
Int -> ReadS NotifyWhenUploaded
ReadS [NotifyWhenUploaded]
(Int -> ReadS NotifyWhenUploaded)
-> ReadS [NotifyWhenUploaded]
-> ReadPrec NotifyWhenUploaded
-> ReadPrec [NotifyWhenUploaded]
-> Read NotifyWhenUploaded
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotifyWhenUploaded]
$creadListPrec :: ReadPrec [NotifyWhenUploaded]
readPrec :: ReadPrec NotifyWhenUploaded
$creadPrec :: ReadPrec NotifyWhenUploaded
readList :: ReadS [NotifyWhenUploaded]
$creadList :: ReadS [NotifyWhenUploaded]
readsPrec :: Int -> ReadS NotifyWhenUploaded
$creadsPrec :: Int -> ReadS NotifyWhenUploaded
Prelude.Read, Int -> NotifyWhenUploaded -> ShowS
[NotifyWhenUploaded] -> ShowS
NotifyWhenUploaded -> String
(Int -> NotifyWhenUploaded -> ShowS)
-> (NotifyWhenUploaded -> String)
-> ([NotifyWhenUploaded] -> ShowS)
-> Show NotifyWhenUploaded
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotifyWhenUploaded] -> ShowS
$cshowList :: [NotifyWhenUploaded] -> ShowS
show :: NotifyWhenUploaded -> String
$cshow :: NotifyWhenUploaded -> String
showsPrec :: Int -> NotifyWhenUploaded -> ShowS
$cshowsPrec :: Int -> NotifyWhenUploaded -> ShowS
Prelude.Show, (forall x. NotifyWhenUploaded -> Rep NotifyWhenUploaded x)
-> (forall x. Rep NotifyWhenUploaded x -> NotifyWhenUploaded)
-> Generic NotifyWhenUploaded
forall x. Rep NotifyWhenUploaded x -> NotifyWhenUploaded
forall x. NotifyWhenUploaded -> Rep NotifyWhenUploaded x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotifyWhenUploaded x -> NotifyWhenUploaded
$cfrom :: forall x. NotifyWhenUploaded -> Rep NotifyWhenUploaded x
Prelude.Generic)
newNotifyWhenUploaded ::
Prelude.Text ->
NotifyWhenUploaded
newNotifyWhenUploaded :: Text -> NotifyWhenUploaded
newNotifyWhenUploaded Text
pFileShareARN_ =
NotifyWhenUploaded' :: Text -> NotifyWhenUploaded
NotifyWhenUploaded' {$sel:fileShareARN:NotifyWhenUploaded' :: Text
fileShareARN = Text
pFileShareARN_}
notifyWhenUploaded_fileShareARN :: Lens.Lens' NotifyWhenUploaded Prelude.Text
notifyWhenUploaded_fileShareARN :: (Text -> f Text) -> NotifyWhenUploaded -> f NotifyWhenUploaded
notifyWhenUploaded_fileShareARN = (NotifyWhenUploaded -> Text)
-> (NotifyWhenUploaded -> Text -> NotifyWhenUploaded)
-> Lens NotifyWhenUploaded NotifyWhenUploaded Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWhenUploaded' {Text
fileShareARN :: Text
$sel:fileShareARN:NotifyWhenUploaded' :: NotifyWhenUploaded -> Text
fileShareARN} -> Text
fileShareARN) (\s :: NotifyWhenUploaded
s@NotifyWhenUploaded' {} Text
a -> NotifyWhenUploaded
s {$sel:fileShareARN:NotifyWhenUploaded' :: Text
fileShareARN = Text
a} :: NotifyWhenUploaded)
instance Core.AWSRequest NotifyWhenUploaded where
type
AWSResponse NotifyWhenUploaded =
NotifyWhenUploadedResponse
request :: NotifyWhenUploaded -> Request NotifyWhenUploaded
request = Service -> NotifyWhenUploaded -> Request NotifyWhenUploaded
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy NotifyWhenUploaded
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse NotifyWhenUploaded)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse NotifyWhenUploaded))
-> Logger
-> Service
-> Proxy NotifyWhenUploaded
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse NotifyWhenUploaded)))
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 -> NotifyWhenUploadedResponse
NotifyWhenUploadedResponse'
(Maybe Text -> Maybe Text -> Int -> NotifyWhenUploadedResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> NotifyWhenUploadedResponse)
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 -> NotifyWhenUploadedResponse)
-> Either String (Maybe Text)
-> Either String (Int -> NotifyWhenUploadedResponse)
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 -> NotifyWhenUploadedResponse)
-> Either String Int -> Either String NotifyWhenUploadedResponse
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 NotifyWhenUploaded
instance Prelude.NFData NotifyWhenUploaded
instance Core.ToHeaders NotifyWhenUploaded where
toHeaders :: NotifyWhenUploaded -> ResponseHeaders
toHeaders =
ResponseHeaders -> NotifyWhenUploaded -> 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.NotifyWhenUploaded" ::
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 NotifyWhenUploaded where
toJSON :: NotifyWhenUploaded -> Value
toJSON NotifyWhenUploaded' {Text
fileShareARN :: Text
$sel:fileShareARN:NotifyWhenUploaded' :: NotifyWhenUploaded -> 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
"FileShareARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fileShareARN)]
)
instance Core.ToPath NotifyWhenUploaded where
toPath :: NotifyWhenUploaded -> ByteString
toPath = ByteString -> NotifyWhenUploaded -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery NotifyWhenUploaded where
toQuery :: NotifyWhenUploaded -> QueryString
toQuery = QueryString -> NotifyWhenUploaded -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data NotifyWhenUploadedResponse = NotifyWhenUploadedResponse'
{ NotifyWhenUploadedResponse -> Maybe Text
fileShareARN :: Prelude.Maybe Prelude.Text,
NotifyWhenUploadedResponse -> Maybe Text
notificationId :: Prelude.Maybe Prelude.Text,
NotifyWhenUploadedResponse -> Int
httpStatus :: Prelude.Int
}
deriving (NotifyWhenUploadedResponse -> NotifyWhenUploadedResponse -> Bool
(NotifyWhenUploadedResponse -> NotifyWhenUploadedResponse -> Bool)
-> (NotifyWhenUploadedResponse
-> NotifyWhenUploadedResponse -> Bool)
-> Eq NotifyWhenUploadedResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotifyWhenUploadedResponse -> NotifyWhenUploadedResponse -> Bool
$c/= :: NotifyWhenUploadedResponse -> NotifyWhenUploadedResponse -> Bool
== :: NotifyWhenUploadedResponse -> NotifyWhenUploadedResponse -> Bool
$c== :: NotifyWhenUploadedResponse -> NotifyWhenUploadedResponse -> Bool
Prelude.Eq, ReadPrec [NotifyWhenUploadedResponse]
ReadPrec NotifyWhenUploadedResponse
Int -> ReadS NotifyWhenUploadedResponse
ReadS [NotifyWhenUploadedResponse]
(Int -> ReadS NotifyWhenUploadedResponse)
-> ReadS [NotifyWhenUploadedResponse]
-> ReadPrec NotifyWhenUploadedResponse
-> ReadPrec [NotifyWhenUploadedResponse]
-> Read NotifyWhenUploadedResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotifyWhenUploadedResponse]
$creadListPrec :: ReadPrec [NotifyWhenUploadedResponse]
readPrec :: ReadPrec NotifyWhenUploadedResponse
$creadPrec :: ReadPrec NotifyWhenUploadedResponse
readList :: ReadS [NotifyWhenUploadedResponse]
$creadList :: ReadS [NotifyWhenUploadedResponse]
readsPrec :: Int -> ReadS NotifyWhenUploadedResponse
$creadsPrec :: Int -> ReadS NotifyWhenUploadedResponse
Prelude.Read, Int -> NotifyWhenUploadedResponse -> ShowS
[NotifyWhenUploadedResponse] -> ShowS
NotifyWhenUploadedResponse -> String
(Int -> NotifyWhenUploadedResponse -> ShowS)
-> (NotifyWhenUploadedResponse -> String)
-> ([NotifyWhenUploadedResponse] -> ShowS)
-> Show NotifyWhenUploadedResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotifyWhenUploadedResponse] -> ShowS
$cshowList :: [NotifyWhenUploadedResponse] -> ShowS
show :: NotifyWhenUploadedResponse -> String
$cshow :: NotifyWhenUploadedResponse -> String
showsPrec :: Int -> NotifyWhenUploadedResponse -> ShowS
$cshowsPrec :: Int -> NotifyWhenUploadedResponse -> ShowS
Prelude.Show, (forall x.
NotifyWhenUploadedResponse -> Rep NotifyWhenUploadedResponse x)
-> (forall x.
Rep NotifyWhenUploadedResponse x -> NotifyWhenUploadedResponse)
-> Generic NotifyWhenUploadedResponse
forall x.
Rep NotifyWhenUploadedResponse x -> NotifyWhenUploadedResponse
forall x.
NotifyWhenUploadedResponse -> Rep NotifyWhenUploadedResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NotifyWhenUploadedResponse x -> NotifyWhenUploadedResponse
$cfrom :: forall x.
NotifyWhenUploadedResponse -> Rep NotifyWhenUploadedResponse x
Prelude.Generic)
newNotifyWhenUploadedResponse ::
Prelude.Int ->
NotifyWhenUploadedResponse
newNotifyWhenUploadedResponse :: Int -> NotifyWhenUploadedResponse
newNotifyWhenUploadedResponse Int
pHttpStatus_ =
NotifyWhenUploadedResponse' :: Maybe Text -> Maybe Text -> Int -> NotifyWhenUploadedResponse
NotifyWhenUploadedResponse'
{ $sel:fileShareARN:NotifyWhenUploadedResponse' :: Maybe Text
fileShareARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:notificationId:NotifyWhenUploadedResponse' :: Maybe Text
notificationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:NotifyWhenUploadedResponse' :: Int
httpStatus = Int
pHttpStatus_
}
notifyWhenUploadedResponse_fileShareARN :: Lens.Lens' NotifyWhenUploadedResponse (Prelude.Maybe Prelude.Text)
notifyWhenUploadedResponse_fileShareARN :: (Maybe Text -> f (Maybe Text))
-> NotifyWhenUploadedResponse -> f NotifyWhenUploadedResponse
notifyWhenUploadedResponse_fileShareARN = (NotifyWhenUploadedResponse -> Maybe Text)
-> (NotifyWhenUploadedResponse
-> Maybe Text -> NotifyWhenUploadedResponse)
-> Lens
NotifyWhenUploadedResponse
NotifyWhenUploadedResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWhenUploadedResponse' {Maybe Text
fileShareARN :: Maybe Text
$sel:fileShareARN:NotifyWhenUploadedResponse' :: NotifyWhenUploadedResponse -> Maybe Text
fileShareARN} -> Maybe Text
fileShareARN) (\s :: NotifyWhenUploadedResponse
s@NotifyWhenUploadedResponse' {} Maybe Text
a -> NotifyWhenUploadedResponse
s {$sel:fileShareARN:NotifyWhenUploadedResponse' :: Maybe Text
fileShareARN = Maybe Text
a} :: NotifyWhenUploadedResponse)
notifyWhenUploadedResponse_notificationId :: Lens.Lens' NotifyWhenUploadedResponse (Prelude.Maybe Prelude.Text)
notifyWhenUploadedResponse_notificationId :: (Maybe Text -> f (Maybe Text))
-> NotifyWhenUploadedResponse -> f NotifyWhenUploadedResponse
notifyWhenUploadedResponse_notificationId = (NotifyWhenUploadedResponse -> Maybe Text)
-> (NotifyWhenUploadedResponse
-> Maybe Text -> NotifyWhenUploadedResponse)
-> Lens
NotifyWhenUploadedResponse
NotifyWhenUploadedResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWhenUploadedResponse' {Maybe Text
notificationId :: Maybe Text
$sel:notificationId:NotifyWhenUploadedResponse' :: NotifyWhenUploadedResponse -> Maybe Text
notificationId} -> Maybe Text
notificationId) (\s :: NotifyWhenUploadedResponse
s@NotifyWhenUploadedResponse' {} Maybe Text
a -> NotifyWhenUploadedResponse
s {$sel:notificationId:NotifyWhenUploadedResponse' :: Maybe Text
notificationId = Maybe Text
a} :: NotifyWhenUploadedResponse)
notifyWhenUploadedResponse_httpStatus :: Lens.Lens' NotifyWhenUploadedResponse Prelude.Int
notifyWhenUploadedResponse_httpStatus :: (Int -> f Int)
-> NotifyWhenUploadedResponse -> f NotifyWhenUploadedResponse
notifyWhenUploadedResponse_httpStatus = (NotifyWhenUploadedResponse -> Int)
-> (NotifyWhenUploadedResponse
-> Int -> NotifyWhenUploadedResponse)
-> Lens
NotifyWhenUploadedResponse NotifyWhenUploadedResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyWhenUploadedResponse' {Int
httpStatus :: Int
$sel:httpStatus:NotifyWhenUploadedResponse' :: NotifyWhenUploadedResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: NotifyWhenUploadedResponse
s@NotifyWhenUploadedResponse' {} Int
a -> NotifyWhenUploadedResponse
s {$sel:httpStatus:NotifyWhenUploadedResponse' :: Int
httpStatus = Int
a} :: NotifyWhenUploadedResponse)
instance Prelude.NFData NotifyWhenUploadedResponse