{-# 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.BulkPublish
(
BulkPublish (..),
newBulkPublish,
bulkPublish_identityPoolId,
BulkPublishResponse (..),
newBulkPublishResponse,
bulkPublishResponse_identityPoolId,
bulkPublishResponse_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 BulkPublish = BulkPublish'
{
BulkPublish -> Text
identityPoolId :: Prelude.Text
}
deriving (BulkPublish -> BulkPublish -> Bool
(BulkPublish -> BulkPublish -> Bool)
-> (BulkPublish -> BulkPublish -> Bool) -> Eq BulkPublish
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BulkPublish -> BulkPublish -> Bool
$c/= :: BulkPublish -> BulkPublish -> Bool
== :: BulkPublish -> BulkPublish -> Bool
$c== :: BulkPublish -> BulkPublish -> Bool
Prelude.Eq, ReadPrec [BulkPublish]
ReadPrec BulkPublish
Int -> ReadS BulkPublish
ReadS [BulkPublish]
(Int -> ReadS BulkPublish)
-> ReadS [BulkPublish]
-> ReadPrec BulkPublish
-> ReadPrec [BulkPublish]
-> Read BulkPublish
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BulkPublish]
$creadListPrec :: ReadPrec [BulkPublish]
readPrec :: ReadPrec BulkPublish
$creadPrec :: ReadPrec BulkPublish
readList :: ReadS [BulkPublish]
$creadList :: ReadS [BulkPublish]
readsPrec :: Int -> ReadS BulkPublish
$creadsPrec :: Int -> ReadS BulkPublish
Prelude.Read, Int -> BulkPublish -> ShowS
[BulkPublish] -> ShowS
BulkPublish -> String
(Int -> BulkPublish -> ShowS)
-> (BulkPublish -> String)
-> ([BulkPublish] -> ShowS)
-> Show BulkPublish
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BulkPublish] -> ShowS
$cshowList :: [BulkPublish] -> ShowS
show :: BulkPublish -> String
$cshow :: BulkPublish -> String
showsPrec :: Int -> BulkPublish -> ShowS
$cshowsPrec :: Int -> BulkPublish -> ShowS
Prelude.Show, (forall x. BulkPublish -> Rep BulkPublish x)
-> (forall x. Rep BulkPublish x -> BulkPublish)
-> Generic BulkPublish
forall x. Rep BulkPublish x -> BulkPublish
forall x. BulkPublish -> Rep BulkPublish x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BulkPublish x -> BulkPublish
$cfrom :: forall x. BulkPublish -> Rep BulkPublish x
Prelude.Generic)
newBulkPublish ::
Prelude.Text ->
BulkPublish
newBulkPublish :: Text -> BulkPublish
newBulkPublish Text
pIdentityPoolId_ =
BulkPublish' :: Text -> BulkPublish
BulkPublish' {$sel:identityPoolId:BulkPublish' :: Text
identityPoolId = Text
pIdentityPoolId_}
bulkPublish_identityPoolId :: Lens.Lens' BulkPublish Prelude.Text
bulkPublish_identityPoolId :: (Text -> f Text) -> BulkPublish -> f BulkPublish
bulkPublish_identityPoolId = (BulkPublish -> Text)
-> (BulkPublish -> Text -> BulkPublish)
-> Lens BulkPublish BulkPublish Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkPublish' {Text
identityPoolId :: Text
$sel:identityPoolId:BulkPublish' :: BulkPublish -> Text
identityPoolId} -> Text
identityPoolId) (\s :: BulkPublish
s@BulkPublish' {} Text
a -> BulkPublish
s {$sel:identityPoolId:BulkPublish' :: Text
identityPoolId = Text
a} :: BulkPublish)
instance Core.AWSRequest BulkPublish where
type AWSResponse BulkPublish = BulkPublishResponse
request :: BulkPublish -> Request BulkPublish
request = Service -> BulkPublish -> Request BulkPublish
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BulkPublish
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BulkPublish)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BulkPublish))
-> Logger
-> Service
-> Proxy BulkPublish
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BulkPublish)))
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 -> BulkPublishResponse
BulkPublishResponse'
(Maybe Text -> Int -> BulkPublishResponse)
-> Either String (Maybe Text)
-> Either String (Int -> BulkPublishResponse)
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
"IdentityPoolId")
Either String (Int -> BulkPublishResponse)
-> Either String Int -> Either String BulkPublishResponse
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 BulkPublish
instance Prelude.NFData BulkPublish
instance Core.ToHeaders BulkPublish where
toHeaders :: BulkPublish -> ResponseHeaders
toHeaders =
ResponseHeaders -> BulkPublish -> 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 BulkPublish where
toJSON :: BulkPublish -> Value
toJSON = Value -> BulkPublish -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath BulkPublish where
toPath :: BulkPublish -> ByteString
toPath BulkPublish' {Text
identityPoolId :: Text
$sel:identityPoolId:BulkPublish' :: BulkPublish -> 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
"/bulkpublish"
]
instance Core.ToQuery BulkPublish where
toQuery :: BulkPublish -> QueryString
toQuery = QueryString -> BulkPublish -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BulkPublishResponse = BulkPublishResponse'
{
BulkPublishResponse -> Maybe Text
identityPoolId :: Prelude.Maybe Prelude.Text,
BulkPublishResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BulkPublishResponse -> BulkPublishResponse -> Bool
(BulkPublishResponse -> BulkPublishResponse -> Bool)
-> (BulkPublishResponse -> BulkPublishResponse -> Bool)
-> Eq BulkPublishResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BulkPublishResponse -> BulkPublishResponse -> Bool
$c/= :: BulkPublishResponse -> BulkPublishResponse -> Bool
== :: BulkPublishResponse -> BulkPublishResponse -> Bool
$c== :: BulkPublishResponse -> BulkPublishResponse -> Bool
Prelude.Eq, ReadPrec [BulkPublishResponse]
ReadPrec BulkPublishResponse
Int -> ReadS BulkPublishResponse
ReadS [BulkPublishResponse]
(Int -> ReadS BulkPublishResponse)
-> ReadS [BulkPublishResponse]
-> ReadPrec BulkPublishResponse
-> ReadPrec [BulkPublishResponse]
-> Read BulkPublishResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BulkPublishResponse]
$creadListPrec :: ReadPrec [BulkPublishResponse]
readPrec :: ReadPrec BulkPublishResponse
$creadPrec :: ReadPrec BulkPublishResponse
readList :: ReadS [BulkPublishResponse]
$creadList :: ReadS [BulkPublishResponse]
readsPrec :: Int -> ReadS BulkPublishResponse
$creadsPrec :: Int -> ReadS BulkPublishResponse
Prelude.Read, Int -> BulkPublishResponse -> ShowS
[BulkPublishResponse] -> ShowS
BulkPublishResponse -> String
(Int -> BulkPublishResponse -> ShowS)
-> (BulkPublishResponse -> String)
-> ([BulkPublishResponse] -> ShowS)
-> Show BulkPublishResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BulkPublishResponse] -> ShowS
$cshowList :: [BulkPublishResponse] -> ShowS
show :: BulkPublishResponse -> String
$cshow :: BulkPublishResponse -> String
showsPrec :: Int -> BulkPublishResponse -> ShowS
$cshowsPrec :: Int -> BulkPublishResponse -> ShowS
Prelude.Show, (forall x. BulkPublishResponse -> Rep BulkPublishResponse x)
-> (forall x. Rep BulkPublishResponse x -> BulkPublishResponse)
-> Generic BulkPublishResponse
forall x. Rep BulkPublishResponse x -> BulkPublishResponse
forall x. BulkPublishResponse -> Rep BulkPublishResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BulkPublishResponse x -> BulkPublishResponse
$cfrom :: forall x. BulkPublishResponse -> Rep BulkPublishResponse x
Prelude.Generic)
newBulkPublishResponse ::
Prelude.Int ->
BulkPublishResponse
newBulkPublishResponse :: Int -> BulkPublishResponse
newBulkPublishResponse Int
pHttpStatus_ =
BulkPublishResponse' :: Maybe Text -> Int -> BulkPublishResponse
BulkPublishResponse'
{ $sel:identityPoolId:BulkPublishResponse' :: Maybe Text
identityPoolId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BulkPublishResponse' :: Int
httpStatus = Int
pHttpStatus_
}
bulkPublishResponse_identityPoolId :: Lens.Lens' BulkPublishResponse (Prelude.Maybe Prelude.Text)
bulkPublishResponse_identityPoolId :: (Maybe Text -> f (Maybe Text))
-> BulkPublishResponse -> f BulkPublishResponse
bulkPublishResponse_identityPoolId = (BulkPublishResponse -> Maybe Text)
-> (BulkPublishResponse -> Maybe Text -> BulkPublishResponse)
-> Lens
BulkPublishResponse BulkPublishResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkPublishResponse' {Maybe Text
identityPoolId :: Maybe Text
$sel:identityPoolId:BulkPublishResponse' :: BulkPublishResponse -> Maybe Text
identityPoolId} -> Maybe Text
identityPoolId) (\s :: BulkPublishResponse
s@BulkPublishResponse' {} Maybe Text
a -> BulkPublishResponse
s {$sel:identityPoolId:BulkPublishResponse' :: Maybe Text
identityPoolId = Maybe Text
a} :: BulkPublishResponse)
bulkPublishResponse_httpStatus :: Lens.Lens' BulkPublishResponse Prelude.Int
bulkPublishResponse_httpStatus :: (Int -> f Int) -> BulkPublishResponse -> f BulkPublishResponse
bulkPublishResponse_httpStatus = (BulkPublishResponse -> Int)
-> (BulkPublishResponse -> Int -> BulkPublishResponse)
-> Lens BulkPublishResponse BulkPublishResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkPublishResponse' {Int
httpStatus :: Int
$sel:httpStatus:BulkPublishResponse' :: BulkPublishResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BulkPublishResponse
s@BulkPublishResponse' {} Int
a -> BulkPublishResponse
s {$sel:httpStatus:BulkPublishResponse' :: Int
httpStatus = Int
a} :: BulkPublishResponse)
instance Prelude.NFData BulkPublishResponse