{-# 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.Personalize.CreateDatasetImportJob
(
CreateDatasetImportJob (..),
newCreateDatasetImportJob,
createDatasetImportJob_jobName,
createDatasetImportJob_datasetArn,
createDatasetImportJob_dataSource,
createDatasetImportJob_roleArn,
CreateDatasetImportJobResponse (..),
newCreateDatasetImportJobResponse,
createDatasetImportJobResponse_datasetImportJobArn,
createDatasetImportJobResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateDatasetImportJob = CreateDatasetImportJob'
{
CreateDatasetImportJob -> Text
jobName :: Prelude.Text,
CreateDatasetImportJob -> Text
datasetArn :: Prelude.Text,
CreateDatasetImportJob -> DataSource
dataSource :: DataSource,
CreateDatasetImportJob -> Text
roleArn :: Prelude.Text
}
deriving (CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
(CreateDatasetImportJob -> CreateDatasetImportJob -> Bool)
-> (CreateDatasetImportJob -> CreateDatasetImportJob -> Bool)
-> Eq CreateDatasetImportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
$c/= :: CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
== :: CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
$c== :: CreateDatasetImportJob -> CreateDatasetImportJob -> Bool
Prelude.Eq, ReadPrec [CreateDatasetImportJob]
ReadPrec CreateDatasetImportJob
Int -> ReadS CreateDatasetImportJob
ReadS [CreateDatasetImportJob]
(Int -> ReadS CreateDatasetImportJob)
-> ReadS [CreateDatasetImportJob]
-> ReadPrec CreateDatasetImportJob
-> ReadPrec [CreateDatasetImportJob]
-> Read CreateDatasetImportJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDatasetImportJob]
$creadListPrec :: ReadPrec [CreateDatasetImportJob]
readPrec :: ReadPrec CreateDatasetImportJob
$creadPrec :: ReadPrec CreateDatasetImportJob
readList :: ReadS [CreateDatasetImportJob]
$creadList :: ReadS [CreateDatasetImportJob]
readsPrec :: Int -> ReadS CreateDatasetImportJob
$creadsPrec :: Int -> ReadS CreateDatasetImportJob
Prelude.Read, Int -> CreateDatasetImportJob -> ShowS
[CreateDatasetImportJob] -> ShowS
CreateDatasetImportJob -> String
(Int -> CreateDatasetImportJob -> ShowS)
-> (CreateDatasetImportJob -> String)
-> ([CreateDatasetImportJob] -> ShowS)
-> Show CreateDatasetImportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatasetImportJob] -> ShowS
$cshowList :: [CreateDatasetImportJob] -> ShowS
show :: CreateDatasetImportJob -> String
$cshow :: CreateDatasetImportJob -> String
showsPrec :: Int -> CreateDatasetImportJob -> ShowS
$cshowsPrec :: Int -> CreateDatasetImportJob -> ShowS
Prelude.Show, (forall x. CreateDatasetImportJob -> Rep CreateDatasetImportJob x)
-> (forall x.
Rep CreateDatasetImportJob x -> CreateDatasetImportJob)
-> Generic CreateDatasetImportJob
forall x. Rep CreateDatasetImportJob x -> CreateDatasetImportJob
forall x. CreateDatasetImportJob -> Rep CreateDatasetImportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDatasetImportJob x -> CreateDatasetImportJob
$cfrom :: forall x. CreateDatasetImportJob -> Rep CreateDatasetImportJob x
Prelude.Generic)
newCreateDatasetImportJob ::
Prelude.Text ->
Prelude.Text ->
DataSource ->
Prelude.Text ->
CreateDatasetImportJob
newCreateDatasetImportJob :: Text -> Text -> DataSource -> Text -> CreateDatasetImportJob
newCreateDatasetImportJob
Text
pJobName_
Text
pDatasetArn_
DataSource
pDataSource_
Text
pRoleArn_ =
CreateDatasetImportJob' :: Text -> Text -> DataSource -> Text -> CreateDatasetImportJob
CreateDatasetImportJob'
{ $sel:jobName:CreateDatasetImportJob' :: Text
jobName = Text
pJobName_,
$sel:datasetArn:CreateDatasetImportJob' :: Text
datasetArn = Text
pDatasetArn_,
$sel:dataSource:CreateDatasetImportJob' :: DataSource
dataSource = DataSource
pDataSource_,
$sel:roleArn:CreateDatasetImportJob' :: Text
roleArn = Text
pRoleArn_
}
createDatasetImportJob_jobName :: Lens.Lens' CreateDatasetImportJob Prelude.Text
createDatasetImportJob_jobName :: (Text -> f Text)
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_jobName = (CreateDatasetImportJob -> Text)
-> (CreateDatasetImportJob -> Text -> CreateDatasetImportJob)
-> Lens CreateDatasetImportJob CreateDatasetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Text
jobName :: Text
$sel:jobName:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
jobName} -> Text
jobName) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Text
a -> CreateDatasetImportJob
s {$sel:jobName:CreateDatasetImportJob' :: Text
jobName = Text
a} :: CreateDatasetImportJob)
createDatasetImportJob_datasetArn :: Lens.Lens' CreateDatasetImportJob Prelude.Text
createDatasetImportJob_datasetArn :: (Text -> f Text)
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_datasetArn = (CreateDatasetImportJob -> Text)
-> (CreateDatasetImportJob -> Text -> CreateDatasetImportJob)
-> Lens CreateDatasetImportJob CreateDatasetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Text
datasetArn :: Text
$sel:datasetArn:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
datasetArn} -> Text
datasetArn) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Text
a -> CreateDatasetImportJob
s {$sel:datasetArn:CreateDatasetImportJob' :: Text
datasetArn = Text
a} :: CreateDatasetImportJob)
createDatasetImportJob_dataSource :: Lens.Lens' CreateDatasetImportJob DataSource
createDatasetImportJob_dataSource :: (DataSource -> f DataSource)
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_dataSource = (CreateDatasetImportJob -> DataSource)
-> (CreateDatasetImportJob -> DataSource -> CreateDatasetImportJob)
-> Lens
CreateDatasetImportJob CreateDatasetImportJob DataSource DataSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {DataSource
dataSource :: DataSource
$sel:dataSource:CreateDatasetImportJob' :: CreateDatasetImportJob -> DataSource
dataSource} -> DataSource
dataSource) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} DataSource
a -> CreateDatasetImportJob
s {$sel:dataSource:CreateDatasetImportJob' :: DataSource
dataSource = DataSource
a} :: CreateDatasetImportJob)
createDatasetImportJob_roleArn :: Lens.Lens' CreateDatasetImportJob Prelude.Text
createDatasetImportJob_roleArn :: (Text -> f Text)
-> CreateDatasetImportJob -> f CreateDatasetImportJob
createDatasetImportJob_roleArn = (CreateDatasetImportJob -> Text)
-> (CreateDatasetImportJob -> Text -> CreateDatasetImportJob)
-> Lens CreateDatasetImportJob CreateDatasetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJob' {Text
roleArn :: Text
$sel:roleArn:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
roleArn} -> Text
roleArn) (\s :: CreateDatasetImportJob
s@CreateDatasetImportJob' {} Text
a -> CreateDatasetImportJob
s {$sel:roleArn:CreateDatasetImportJob' :: Text
roleArn = Text
a} :: CreateDatasetImportJob)
instance Core.AWSRequest CreateDatasetImportJob where
type
AWSResponse CreateDatasetImportJob =
CreateDatasetImportJobResponse
request :: CreateDatasetImportJob -> Request CreateDatasetImportJob
request = Service -> CreateDatasetImportJob -> Request CreateDatasetImportJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDatasetImportJob
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDatasetImportJob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDatasetImportJob))
-> Logger
-> Service
-> Proxy CreateDatasetImportJob
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDatasetImportJob)))
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 -> CreateDatasetImportJobResponse
CreateDatasetImportJobResponse'
(Maybe Text -> Int -> CreateDatasetImportJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateDatasetImportJobResponse)
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
"datasetImportJobArn")
Either String (Int -> CreateDatasetImportJobResponse)
-> Either String Int
-> Either String CreateDatasetImportJobResponse
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 CreateDatasetImportJob
instance Prelude.NFData CreateDatasetImportJob
instance Core.ToHeaders CreateDatasetImportJob where
toHeaders :: CreateDatasetImportJob -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDatasetImportJob -> 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
"AmazonPersonalize.CreateDatasetImportJob" ::
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 CreateDatasetImportJob where
toJSON :: CreateDatasetImportJob -> Value
toJSON CreateDatasetImportJob' {Text
DataSource
roleArn :: Text
dataSource :: DataSource
datasetArn :: Text
jobName :: Text
$sel:roleArn:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
$sel:dataSource:CreateDatasetImportJob' :: CreateDatasetImportJob -> DataSource
$sel:datasetArn:CreateDatasetImportJob' :: CreateDatasetImportJob -> Text
$sel:jobName:CreateDatasetImportJob' :: CreateDatasetImportJob -> 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
"jobName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"datasetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dataSource" Text -> DataSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataSource
dataSource),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)
instance Core.ToPath CreateDatasetImportJob where
toPath :: CreateDatasetImportJob -> ByteString
toPath = ByteString -> CreateDatasetImportJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDatasetImportJob where
toQuery :: CreateDatasetImportJob -> QueryString
toQuery = QueryString -> CreateDatasetImportJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateDatasetImportJobResponse = CreateDatasetImportJobResponse'
{
CreateDatasetImportJobResponse -> Maybe Text
datasetImportJobArn :: Prelude.Maybe Prelude.Text,
CreateDatasetImportJobResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
(CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool)
-> (CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool)
-> Eq CreateDatasetImportJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
$c/= :: CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
== :: CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
$c== :: CreateDatasetImportJobResponse
-> CreateDatasetImportJobResponse -> Bool
Prelude.Eq, ReadPrec [CreateDatasetImportJobResponse]
ReadPrec CreateDatasetImportJobResponse
Int -> ReadS CreateDatasetImportJobResponse
ReadS [CreateDatasetImportJobResponse]
(Int -> ReadS CreateDatasetImportJobResponse)
-> ReadS [CreateDatasetImportJobResponse]
-> ReadPrec CreateDatasetImportJobResponse
-> ReadPrec [CreateDatasetImportJobResponse]
-> Read CreateDatasetImportJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDatasetImportJobResponse]
$creadListPrec :: ReadPrec [CreateDatasetImportJobResponse]
readPrec :: ReadPrec CreateDatasetImportJobResponse
$creadPrec :: ReadPrec CreateDatasetImportJobResponse
readList :: ReadS [CreateDatasetImportJobResponse]
$creadList :: ReadS [CreateDatasetImportJobResponse]
readsPrec :: Int -> ReadS CreateDatasetImportJobResponse
$creadsPrec :: Int -> ReadS CreateDatasetImportJobResponse
Prelude.Read, Int -> CreateDatasetImportJobResponse -> ShowS
[CreateDatasetImportJobResponse] -> ShowS
CreateDatasetImportJobResponse -> String
(Int -> CreateDatasetImportJobResponse -> ShowS)
-> (CreateDatasetImportJobResponse -> String)
-> ([CreateDatasetImportJobResponse] -> ShowS)
-> Show CreateDatasetImportJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatasetImportJobResponse] -> ShowS
$cshowList :: [CreateDatasetImportJobResponse] -> ShowS
show :: CreateDatasetImportJobResponse -> String
$cshow :: CreateDatasetImportJobResponse -> String
showsPrec :: Int -> CreateDatasetImportJobResponse -> ShowS
$cshowsPrec :: Int -> CreateDatasetImportJobResponse -> ShowS
Prelude.Show, (forall x.
CreateDatasetImportJobResponse
-> Rep CreateDatasetImportJobResponse x)
-> (forall x.
Rep CreateDatasetImportJobResponse x
-> CreateDatasetImportJobResponse)
-> Generic CreateDatasetImportJobResponse
forall x.
Rep CreateDatasetImportJobResponse x
-> CreateDatasetImportJobResponse
forall x.
CreateDatasetImportJobResponse
-> Rep CreateDatasetImportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDatasetImportJobResponse x
-> CreateDatasetImportJobResponse
$cfrom :: forall x.
CreateDatasetImportJobResponse
-> Rep CreateDatasetImportJobResponse x
Prelude.Generic)
newCreateDatasetImportJobResponse ::
Prelude.Int ->
CreateDatasetImportJobResponse
newCreateDatasetImportJobResponse :: Int -> CreateDatasetImportJobResponse
newCreateDatasetImportJobResponse Int
pHttpStatus_ =
CreateDatasetImportJobResponse' :: Maybe Text -> Int -> CreateDatasetImportJobResponse
CreateDatasetImportJobResponse'
{ $sel:datasetImportJobArn:CreateDatasetImportJobResponse' :: Maybe Text
datasetImportJobArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDatasetImportJobResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDatasetImportJobResponse_datasetImportJobArn :: Lens.Lens' CreateDatasetImportJobResponse (Prelude.Maybe Prelude.Text)
createDatasetImportJobResponse_datasetImportJobArn :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetImportJobResponse
-> f CreateDatasetImportJobResponse
createDatasetImportJobResponse_datasetImportJobArn = (CreateDatasetImportJobResponse -> Maybe Text)
-> (CreateDatasetImportJobResponse
-> Maybe Text -> CreateDatasetImportJobResponse)
-> Lens
CreateDatasetImportJobResponse
CreateDatasetImportJobResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJobResponse' {Maybe Text
datasetImportJobArn :: Maybe Text
$sel:datasetImportJobArn:CreateDatasetImportJobResponse' :: CreateDatasetImportJobResponse -> Maybe Text
datasetImportJobArn} -> Maybe Text
datasetImportJobArn) (\s :: CreateDatasetImportJobResponse
s@CreateDatasetImportJobResponse' {} Maybe Text
a -> CreateDatasetImportJobResponse
s {$sel:datasetImportJobArn:CreateDatasetImportJobResponse' :: Maybe Text
datasetImportJobArn = Maybe Text
a} :: CreateDatasetImportJobResponse)
createDatasetImportJobResponse_httpStatus :: Lens.Lens' CreateDatasetImportJobResponse Prelude.Int
createDatasetImportJobResponse_httpStatus :: (Int -> f Int)
-> CreateDatasetImportJobResponse
-> f CreateDatasetImportJobResponse
createDatasetImportJobResponse_httpStatus = (CreateDatasetImportJobResponse -> Int)
-> (CreateDatasetImportJobResponse
-> Int -> CreateDatasetImportJobResponse)
-> Lens
CreateDatasetImportJobResponse
CreateDatasetImportJobResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetImportJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDatasetImportJobResponse' :: CreateDatasetImportJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDatasetImportJobResponse
s@CreateDatasetImportJobResponse' {} Int
a -> CreateDatasetImportJobResponse
s {$sel:httpStatus:CreateDatasetImportJobResponse' :: Int
httpStatus = Int
a} :: CreateDatasetImportJobResponse)
instance
Prelude.NFData
CreateDatasetImportJobResponse