{-# 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.CognitoIdentityProvider.StartUserImportJob
(
StartUserImportJob (..),
newStartUserImportJob,
startUserImportJob_userPoolId,
startUserImportJob_jobId,
StartUserImportJobResponse (..),
newStartUserImportJobResponse,
startUserImportJobResponse_userImportJob,
startUserImportJobResponse_httpStatus,
)
where
import Amazonka.CognitoIdentityProvider.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 StartUserImportJob = StartUserImportJob'
{
StartUserImportJob -> Text
userPoolId :: Prelude.Text,
StartUserImportJob -> Text
jobId :: Prelude.Text
}
deriving (StartUserImportJob -> StartUserImportJob -> Bool
(StartUserImportJob -> StartUserImportJob -> Bool)
-> (StartUserImportJob -> StartUserImportJob -> Bool)
-> Eq StartUserImportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartUserImportJob -> StartUserImportJob -> Bool
$c/= :: StartUserImportJob -> StartUserImportJob -> Bool
== :: StartUserImportJob -> StartUserImportJob -> Bool
$c== :: StartUserImportJob -> StartUserImportJob -> Bool
Prelude.Eq, ReadPrec [StartUserImportJob]
ReadPrec StartUserImportJob
Int -> ReadS StartUserImportJob
ReadS [StartUserImportJob]
(Int -> ReadS StartUserImportJob)
-> ReadS [StartUserImportJob]
-> ReadPrec StartUserImportJob
-> ReadPrec [StartUserImportJob]
-> Read StartUserImportJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartUserImportJob]
$creadListPrec :: ReadPrec [StartUserImportJob]
readPrec :: ReadPrec StartUserImportJob
$creadPrec :: ReadPrec StartUserImportJob
readList :: ReadS [StartUserImportJob]
$creadList :: ReadS [StartUserImportJob]
readsPrec :: Int -> ReadS StartUserImportJob
$creadsPrec :: Int -> ReadS StartUserImportJob
Prelude.Read, Int -> StartUserImportJob -> ShowS
[StartUserImportJob] -> ShowS
StartUserImportJob -> String
(Int -> StartUserImportJob -> ShowS)
-> (StartUserImportJob -> String)
-> ([StartUserImportJob] -> ShowS)
-> Show StartUserImportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartUserImportJob] -> ShowS
$cshowList :: [StartUserImportJob] -> ShowS
show :: StartUserImportJob -> String
$cshow :: StartUserImportJob -> String
showsPrec :: Int -> StartUserImportJob -> ShowS
$cshowsPrec :: Int -> StartUserImportJob -> ShowS
Prelude.Show, (forall x. StartUserImportJob -> Rep StartUserImportJob x)
-> (forall x. Rep StartUserImportJob x -> StartUserImportJob)
-> Generic StartUserImportJob
forall x. Rep StartUserImportJob x -> StartUserImportJob
forall x. StartUserImportJob -> Rep StartUserImportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartUserImportJob x -> StartUserImportJob
$cfrom :: forall x. StartUserImportJob -> Rep StartUserImportJob x
Prelude.Generic)
newStartUserImportJob ::
Prelude.Text ->
Prelude.Text ->
StartUserImportJob
newStartUserImportJob :: Text -> Text -> StartUserImportJob
newStartUserImportJob Text
pUserPoolId_ Text
pJobId_ =
StartUserImportJob' :: Text -> Text -> StartUserImportJob
StartUserImportJob'
{ $sel:userPoolId:StartUserImportJob' :: Text
userPoolId = Text
pUserPoolId_,
$sel:jobId:StartUserImportJob' :: Text
jobId = Text
pJobId_
}
startUserImportJob_userPoolId :: Lens.Lens' StartUserImportJob Prelude.Text
startUserImportJob_userPoolId :: (Text -> f Text) -> StartUserImportJob -> f StartUserImportJob
startUserImportJob_userPoolId = (StartUserImportJob -> Text)
-> (StartUserImportJob -> Text -> StartUserImportJob)
-> Lens StartUserImportJob StartUserImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartUserImportJob' {Text
userPoolId :: Text
$sel:userPoolId:StartUserImportJob' :: StartUserImportJob -> Text
userPoolId} -> Text
userPoolId) (\s :: StartUserImportJob
s@StartUserImportJob' {} Text
a -> StartUserImportJob
s {$sel:userPoolId:StartUserImportJob' :: Text
userPoolId = Text
a} :: StartUserImportJob)
startUserImportJob_jobId :: Lens.Lens' StartUserImportJob Prelude.Text
startUserImportJob_jobId :: (Text -> f Text) -> StartUserImportJob -> f StartUserImportJob
startUserImportJob_jobId = (StartUserImportJob -> Text)
-> (StartUserImportJob -> Text -> StartUserImportJob)
-> Lens StartUserImportJob StartUserImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartUserImportJob' {Text
jobId :: Text
$sel:jobId:StartUserImportJob' :: StartUserImportJob -> Text
jobId} -> Text
jobId) (\s :: StartUserImportJob
s@StartUserImportJob' {} Text
a -> StartUserImportJob
s {$sel:jobId:StartUserImportJob' :: Text
jobId = Text
a} :: StartUserImportJob)
instance Core.AWSRequest StartUserImportJob where
type
AWSResponse StartUserImportJob =
StartUserImportJobResponse
request :: StartUserImportJob -> Request StartUserImportJob
request = Service -> StartUserImportJob -> Request StartUserImportJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartUserImportJob
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartUserImportJob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartUserImportJob))
-> Logger
-> Service
-> Proxy StartUserImportJob
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartUserImportJob)))
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 UserImportJobType -> Int -> StartUserImportJobResponse
StartUserImportJobResponse'
(Maybe UserImportJobType -> Int -> StartUserImportJobResponse)
-> Either String (Maybe UserImportJobType)
-> Either String (Int -> StartUserImportJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe UserImportJobType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UserImportJob")
Either String (Int -> StartUserImportJobResponse)
-> Either String Int -> Either String StartUserImportJobResponse
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 StartUserImportJob
instance Prelude.NFData StartUserImportJob
instance Core.ToHeaders StartUserImportJob where
toHeaders :: StartUserImportJob -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartUserImportJob -> 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
"AWSCognitoIdentityProviderService.StartUserImportJob" ::
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 StartUserImportJob where
toJSON :: StartUserImportJob -> Value
toJSON StartUserImportJob' {Text
jobId :: Text
userPoolId :: Text
$sel:jobId:StartUserImportJob' :: StartUserImportJob -> Text
$sel:userPoolId:StartUserImportJob' :: StartUserImportJob -> 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
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobId)
]
)
instance Core.ToPath StartUserImportJob where
toPath :: StartUserImportJob -> ByteString
toPath = ByteString -> StartUserImportJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartUserImportJob where
toQuery :: StartUserImportJob -> QueryString
toQuery = QueryString -> StartUserImportJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartUserImportJobResponse = StartUserImportJobResponse'
{
StartUserImportJobResponse -> Maybe UserImportJobType
userImportJob :: Prelude.Maybe UserImportJobType,
StartUserImportJobResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartUserImportJobResponse -> StartUserImportJobResponse -> Bool
(StartUserImportJobResponse -> StartUserImportJobResponse -> Bool)
-> (StartUserImportJobResponse
-> StartUserImportJobResponse -> Bool)
-> Eq StartUserImportJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartUserImportJobResponse -> StartUserImportJobResponse -> Bool
$c/= :: StartUserImportJobResponse -> StartUserImportJobResponse -> Bool
== :: StartUserImportJobResponse -> StartUserImportJobResponse -> Bool
$c== :: StartUserImportJobResponse -> StartUserImportJobResponse -> Bool
Prelude.Eq, ReadPrec [StartUserImportJobResponse]
ReadPrec StartUserImportJobResponse
Int -> ReadS StartUserImportJobResponse
ReadS [StartUserImportJobResponse]
(Int -> ReadS StartUserImportJobResponse)
-> ReadS [StartUserImportJobResponse]
-> ReadPrec StartUserImportJobResponse
-> ReadPrec [StartUserImportJobResponse]
-> Read StartUserImportJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartUserImportJobResponse]
$creadListPrec :: ReadPrec [StartUserImportJobResponse]
readPrec :: ReadPrec StartUserImportJobResponse
$creadPrec :: ReadPrec StartUserImportJobResponse
readList :: ReadS [StartUserImportJobResponse]
$creadList :: ReadS [StartUserImportJobResponse]
readsPrec :: Int -> ReadS StartUserImportJobResponse
$creadsPrec :: Int -> ReadS StartUserImportJobResponse
Prelude.Read, Int -> StartUserImportJobResponse -> ShowS
[StartUserImportJobResponse] -> ShowS
StartUserImportJobResponse -> String
(Int -> StartUserImportJobResponse -> ShowS)
-> (StartUserImportJobResponse -> String)
-> ([StartUserImportJobResponse] -> ShowS)
-> Show StartUserImportJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartUserImportJobResponse] -> ShowS
$cshowList :: [StartUserImportJobResponse] -> ShowS
show :: StartUserImportJobResponse -> String
$cshow :: StartUserImportJobResponse -> String
showsPrec :: Int -> StartUserImportJobResponse -> ShowS
$cshowsPrec :: Int -> StartUserImportJobResponse -> ShowS
Prelude.Show, (forall x.
StartUserImportJobResponse -> Rep StartUserImportJobResponse x)
-> (forall x.
Rep StartUserImportJobResponse x -> StartUserImportJobResponse)
-> Generic StartUserImportJobResponse
forall x.
Rep StartUserImportJobResponse x -> StartUserImportJobResponse
forall x.
StartUserImportJobResponse -> Rep StartUserImportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartUserImportJobResponse x -> StartUserImportJobResponse
$cfrom :: forall x.
StartUserImportJobResponse -> Rep StartUserImportJobResponse x
Prelude.Generic)
newStartUserImportJobResponse ::
Prelude.Int ->
StartUserImportJobResponse
newStartUserImportJobResponse :: Int -> StartUserImportJobResponse
newStartUserImportJobResponse Int
pHttpStatus_ =
StartUserImportJobResponse' :: Maybe UserImportJobType -> Int -> StartUserImportJobResponse
StartUserImportJobResponse'
{ $sel:userImportJob:StartUserImportJobResponse' :: Maybe UserImportJobType
userImportJob =
Maybe UserImportJobType
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartUserImportJobResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startUserImportJobResponse_userImportJob :: Lens.Lens' StartUserImportJobResponse (Prelude.Maybe UserImportJobType)
startUserImportJobResponse_userImportJob :: (Maybe UserImportJobType -> f (Maybe UserImportJobType))
-> StartUserImportJobResponse -> f StartUserImportJobResponse
startUserImportJobResponse_userImportJob = (StartUserImportJobResponse -> Maybe UserImportJobType)
-> (StartUserImportJobResponse
-> Maybe UserImportJobType -> StartUserImportJobResponse)
-> Lens
StartUserImportJobResponse
StartUserImportJobResponse
(Maybe UserImportJobType)
(Maybe UserImportJobType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartUserImportJobResponse' {Maybe UserImportJobType
userImportJob :: Maybe UserImportJobType
$sel:userImportJob:StartUserImportJobResponse' :: StartUserImportJobResponse -> Maybe UserImportJobType
userImportJob} -> Maybe UserImportJobType
userImportJob) (\s :: StartUserImportJobResponse
s@StartUserImportJobResponse' {} Maybe UserImportJobType
a -> StartUserImportJobResponse
s {$sel:userImportJob:StartUserImportJobResponse' :: Maybe UserImportJobType
userImportJob = Maybe UserImportJobType
a} :: StartUserImportJobResponse)
startUserImportJobResponse_httpStatus :: Lens.Lens' StartUserImportJobResponse Prelude.Int
startUserImportJobResponse_httpStatus :: (Int -> f Int)
-> StartUserImportJobResponse -> f StartUserImportJobResponse
startUserImportJobResponse_httpStatus = (StartUserImportJobResponse -> Int)
-> (StartUserImportJobResponse
-> Int -> StartUserImportJobResponse)
-> Lens
StartUserImportJobResponse StartUserImportJobResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartUserImportJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartUserImportJobResponse' :: StartUserImportJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartUserImportJobResponse
s@StartUserImportJobResponse' {} Int
a -> StartUserImportJobResponse
s {$sel:httpStatus:StartUserImportJobResponse' :: Int
httpStatus = Int
a} :: StartUserImportJobResponse)
instance Prelude.NFData StartUserImportJobResponse