{-# 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.CognitoSync.SubscribeToDataset
(
SubscribeToDataset (..),
newSubscribeToDataset,
subscribeToDataset_identityPoolId,
subscribeToDataset_identityId,
subscribeToDataset_datasetName,
subscribeToDataset_deviceId,
SubscribeToDatasetResponse (..),
newSubscribeToDatasetResponse,
subscribeToDatasetResponse_httpStatus,
)
where
import Amazonka.CognitoSync.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
data SubscribeToDataset = SubscribeToDataset'
{
SubscribeToDataset -> Text
identityPoolId :: Prelude.Text,
SubscribeToDataset -> Text
identityId :: Prelude.Text,
SubscribeToDataset -> Text
datasetName :: Prelude.Text,
SubscribeToDataset -> Text
deviceId :: Prelude.Text
}
deriving (SubscribeToDataset -> SubscribeToDataset -> Bool
(SubscribeToDataset -> SubscribeToDataset -> Bool)
-> (SubscribeToDataset -> SubscribeToDataset -> Bool)
-> Eq SubscribeToDataset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubscribeToDataset -> SubscribeToDataset -> Bool
$c/= :: SubscribeToDataset -> SubscribeToDataset -> Bool
== :: SubscribeToDataset -> SubscribeToDataset -> Bool
$c== :: SubscribeToDataset -> SubscribeToDataset -> Bool
Prelude.Eq, ReadPrec [SubscribeToDataset]
ReadPrec SubscribeToDataset
Int -> ReadS SubscribeToDataset
ReadS [SubscribeToDataset]
(Int -> ReadS SubscribeToDataset)
-> ReadS [SubscribeToDataset]
-> ReadPrec SubscribeToDataset
-> ReadPrec [SubscribeToDataset]
-> Read SubscribeToDataset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubscribeToDataset]
$creadListPrec :: ReadPrec [SubscribeToDataset]
readPrec :: ReadPrec SubscribeToDataset
$creadPrec :: ReadPrec SubscribeToDataset
readList :: ReadS [SubscribeToDataset]
$creadList :: ReadS [SubscribeToDataset]
readsPrec :: Int -> ReadS SubscribeToDataset
$creadsPrec :: Int -> ReadS SubscribeToDataset
Prelude.Read, Int -> SubscribeToDataset -> ShowS
[SubscribeToDataset] -> ShowS
SubscribeToDataset -> String
(Int -> SubscribeToDataset -> ShowS)
-> (SubscribeToDataset -> String)
-> ([SubscribeToDataset] -> ShowS)
-> Show SubscribeToDataset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubscribeToDataset] -> ShowS
$cshowList :: [SubscribeToDataset] -> ShowS
show :: SubscribeToDataset -> String
$cshow :: SubscribeToDataset -> String
showsPrec :: Int -> SubscribeToDataset -> ShowS
$cshowsPrec :: Int -> SubscribeToDataset -> ShowS
Prelude.Show, (forall x. SubscribeToDataset -> Rep SubscribeToDataset x)
-> (forall x. Rep SubscribeToDataset x -> SubscribeToDataset)
-> Generic SubscribeToDataset
forall x. Rep SubscribeToDataset x -> SubscribeToDataset
forall x. SubscribeToDataset -> Rep SubscribeToDataset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubscribeToDataset x -> SubscribeToDataset
$cfrom :: forall x. SubscribeToDataset -> Rep SubscribeToDataset x
Prelude.Generic)
newSubscribeToDataset ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
SubscribeToDataset
newSubscribeToDataset :: Text -> Text -> Text -> Text -> SubscribeToDataset
newSubscribeToDataset
Text
pIdentityPoolId_
Text
pIdentityId_
Text
pDatasetName_
Text
pDeviceId_ =
SubscribeToDataset' :: Text -> Text -> Text -> Text -> SubscribeToDataset
SubscribeToDataset'
{ $sel:identityPoolId:SubscribeToDataset' :: Text
identityPoolId =
Text
pIdentityPoolId_,
$sel:identityId:SubscribeToDataset' :: Text
identityId = Text
pIdentityId_,
$sel:datasetName:SubscribeToDataset' :: Text
datasetName = Text
pDatasetName_,
$sel:deviceId:SubscribeToDataset' :: Text
deviceId = Text
pDeviceId_
}
subscribeToDataset_identityPoolId :: Lens.Lens' SubscribeToDataset Prelude.Text
subscribeToDataset_identityPoolId :: (Text -> f Text) -> SubscribeToDataset -> f SubscribeToDataset
subscribeToDataset_identityPoolId = (SubscribeToDataset -> Text)
-> (SubscribeToDataset -> Text -> SubscribeToDataset)
-> Lens SubscribeToDataset SubscribeToDataset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribeToDataset' {Text
identityPoolId :: Text
$sel:identityPoolId:SubscribeToDataset' :: SubscribeToDataset -> Text
identityPoolId} -> Text
identityPoolId) (\s :: SubscribeToDataset
s@SubscribeToDataset' {} Text
a -> SubscribeToDataset
s {$sel:identityPoolId:SubscribeToDataset' :: Text
identityPoolId = Text
a} :: SubscribeToDataset)
subscribeToDataset_identityId :: Lens.Lens' SubscribeToDataset Prelude.Text
subscribeToDataset_identityId :: (Text -> f Text) -> SubscribeToDataset -> f SubscribeToDataset
subscribeToDataset_identityId = (SubscribeToDataset -> Text)
-> (SubscribeToDataset -> Text -> SubscribeToDataset)
-> Lens SubscribeToDataset SubscribeToDataset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribeToDataset' {Text
identityId :: Text
$sel:identityId:SubscribeToDataset' :: SubscribeToDataset -> Text
identityId} -> Text
identityId) (\s :: SubscribeToDataset
s@SubscribeToDataset' {} Text
a -> SubscribeToDataset
s {$sel:identityId:SubscribeToDataset' :: Text
identityId = Text
a} :: SubscribeToDataset)
subscribeToDataset_datasetName :: Lens.Lens' SubscribeToDataset Prelude.Text
subscribeToDataset_datasetName :: (Text -> f Text) -> SubscribeToDataset -> f SubscribeToDataset
subscribeToDataset_datasetName = (SubscribeToDataset -> Text)
-> (SubscribeToDataset -> Text -> SubscribeToDataset)
-> Lens SubscribeToDataset SubscribeToDataset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribeToDataset' {Text
datasetName :: Text
$sel:datasetName:SubscribeToDataset' :: SubscribeToDataset -> Text
datasetName} -> Text
datasetName) (\s :: SubscribeToDataset
s@SubscribeToDataset' {} Text
a -> SubscribeToDataset
s {$sel:datasetName:SubscribeToDataset' :: Text
datasetName = Text
a} :: SubscribeToDataset)
subscribeToDataset_deviceId :: Lens.Lens' SubscribeToDataset Prelude.Text
subscribeToDataset_deviceId :: (Text -> f Text) -> SubscribeToDataset -> f SubscribeToDataset
subscribeToDataset_deviceId = (SubscribeToDataset -> Text)
-> (SubscribeToDataset -> Text -> SubscribeToDataset)
-> Lens SubscribeToDataset SubscribeToDataset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribeToDataset' {Text
deviceId :: Text
$sel:deviceId:SubscribeToDataset' :: SubscribeToDataset -> Text
deviceId} -> Text
deviceId) (\s :: SubscribeToDataset
s@SubscribeToDataset' {} Text
a -> SubscribeToDataset
s {$sel:deviceId:SubscribeToDataset' :: Text
deviceId = Text
a} :: SubscribeToDataset)
instance Core.AWSRequest SubscribeToDataset where
type
AWSResponse SubscribeToDataset =
SubscribeToDatasetResponse
request :: SubscribeToDataset -> Request SubscribeToDataset
request = Service -> SubscribeToDataset -> Request SubscribeToDataset
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SubscribeToDataset
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SubscribeToDataset)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse SubscribeToDataset))
-> Logger
-> Service
-> Proxy SubscribeToDataset
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SubscribeToDataset)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> SubscribeToDatasetResponse
SubscribeToDatasetResponse'
(Int -> SubscribeToDatasetResponse)
-> Either String Int -> Either String SubscribeToDatasetResponse
forall (f :: * -> *) a b. Functor 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 SubscribeToDataset
instance Prelude.NFData SubscribeToDataset
instance Core.ToHeaders SubscribeToDataset where
toHeaders :: SubscribeToDataset -> ResponseHeaders
toHeaders =
ResponseHeaders -> SubscribeToDataset -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 SubscribeToDataset where
toJSON :: SubscribeToDataset -> Value
toJSON = Value -> SubscribeToDataset -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath SubscribeToDataset where
toPath :: SubscribeToDataset -> ByteString
toPath SubscribeToDataset' {Text
deviceId :: Text
datasetName :: Text
identityId :: Text
identityPoolId :: Text
$sel:deviceId:SubscribeToDataset' :: SubscribeToDataset -> Text
$sel:datasetName:SubscribeToDataset' :: SubscribeToDataset -> Text
$sel:identityId:SubscribeToDataset' :: SubscribeToDataset -> Text
$sel:identityPoolId:SubscribeToDataset' :: SubscribeToDataset -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/identitypools/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
identityPoolId,
ByteString
"/identities/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
identityId,
ByteString
"/datasets/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
datasetName,
ByteString
"/subscriptions/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deviceId
]
instance Core.ToQuery SubscribeToDataset where
toQuery :: SubscribeToDataset -> QueryString
toQuery = QueryString -> SubscribeToDataset -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SubscribeToDatasetResponse = SubscribeToDatasetResponse'
{
SubscribeToDatasetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SubscribeToDatasetResponse -> SubscribeToDatasetResponse -> Bool
(SubscribeToDatasetResponse -> SubscribeToDatasetResponse -> Bool)
-> (SubscribeToDatasetResponse
-> SubscribeToDatasetResponse -> Bool)
-> Eq SubscribeToDatasetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubscribeToDatasetResponse -> SubscribeToDatasetResponse -> Bool
$c/= :: SubscribeToDatasetResponse -> SubscribeToDatasetResponse -> Bool
== :: SubscribeToDatasetResponse -> SubscribeToDatasetResponse -> Bool
$c== :: SubscribeToDatasetResponse -> SubscribeToDatasetResponse -> Bool
Prelude.Eq, ReadPrec [SubscribeToDatasetResponse]
ReadPrec SubscribeToDatasetResponse
Int -> ReadS SubscribeToDatasetResponse
ReadS [SubscribeToDatasetResponse]
(Int -> ReadS SubscribeToDatasetResponse)
-> ReadS [SubscribeToDatasetResponse]
-> ReadPrec SubscribeToDatasetResponse
-> ReadPrec [SubscribeToDatasetResponse]
-> Read SubscribeToDatasetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubscribeToDatasetResponse]
$creadListPrec :: ReadPrec [SubscribeToDatasetResponse]
readPrec :: ReadPrec SubscribeToDatasetResponse
$creadPrec :: ReadPrec SubscribeToDatasetResponse
readList :: ReadS [SubscribeToDatasetResponse]
$creadList :: ReadS [SubscribeToDatasetResponse]
readsPrec :: Int -> ReadS SubscribeToDatasetResponse
$creadsPrec :: Int -> ReadS SubscribeToDatasetResponse
Prelude.Read, Int -> SubscribeToDatasetResponse -> ShowS
[SubscribeToDatasetResponse] -> ShowS
SubscribeToDatasetResponse -> String
(Int -> SubscribeToDatasetResponse -> ShowS)
-> (SubscribeToDatasetResponse -> String)
-> ([SubscribeToDatasetResponse] -> ShowS)
-> Show SubscribeToDatasetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubscribeToDatasetResponse] -> ShowS
$cshowList :: [SubscribeToDatasetResponse] -> ShowS
show :: SubscribeToDatasetResponse -> String
$cshow :: SubscribeToDatasetResponse -> String
showsPrec :: Int -> SubscribeToDatasetResponse -> ShowS
$cshowsPrec :: Int -> SubscribeToDatasetResponse -> ShowS
Prelude.Show, (forall x.
SubscribeToDatasetResponse -> Rep SubscribeToDatasetResponse x)
-> (forall x.
Rep SubscribeToDatasetResponse x -> SubscribeToDatasetResponse)
-> Generic SubscribeToDatasetResponse
forall x.
Rep SubscribeToDatasetResponse x -> SubscribeToDatasetResponse
forall x.
SubscribeToDatasetResponse -> Rep SubscribeToDatasetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SubscribeToDatasetResponse x -> SubscribeToDatasetResponse
$cfrom :: forall x.
SubscribeToDatasetResponse -> Rep SubscribeToDatasetResponse x
Prelude.Generic)
newSubscribeToDatasetResponse ::
Prelude.Int ->
SubscribeToDatasetResponse
newSubscribeToDatasetResponse :: Int -> SubscribeToDatasetResponse
newSubscribeToDatasetResponse Int
pHttpStatus_ =
SubscribeToDatasetResponse' :: Int -> SubscribeToDatasetResponse
SubscribeToDatasetResponse'
{ $sel:httpStatus:SubscribeToDatasetResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
subscribeToDatasetResponse_httpStatus :: Lens.Lens' SubscribeToDatasetResponse Prelude.Int
subscribeToDatasetResponse_httpStatus :: (Int -> f Int)
-> SubscribeToDatasetResponse -> f SubscribeToDatasetResponse
subscribeToDatasetResponse_httpStatus = (SubscribeToDatasetResponse -> Int)
-> (SubscribeToDatasetResponse
-> Int -> SubscribeToDatasetResponse)
-> Lens
SubscribeToDatasetResponse SubscribeToDatasetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribeToDatasetResponse' {Int
httpStatus :: Int
$sel:httpStatus:SubscribeToDatasetResponse' :: SubscribeToDatasetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SubscribeToDatasetResponse
s@SubscribeToDatasetResponse' {} Int
a -> SubscribeToDatasetResponse
s {$sel:httpStatus:SubscribeToDatasetResponse' :: Int
httpStatus = Int
a} :: SubscribeToDatasetResponse)
instance Prelude.NFData SubscribeToDatasetResponse