{-# 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.CreateDataset
(
CreateDataset (..),
newCreateDataset,
createDataset_name,
createDataset_schemaArn,
createDataset_datasetGroupArn,
createDataset_datasetType,
CreateDatasetResponse (..),
newCreateDatasetResponse,
createDatasetResponse_datasetArn,
createDatasetResponse_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 CreateDataset = CreateDataset'
{
CreateDataset -> Text
name :: Prelude.Text,
CreateDataset -> Text
schemaArn :: Prelude.Text,
CreateDataset -> Text
datasetGroupArn :: Prelude.Text,
CreateDataset -> Text
datasetType :: Prelude.Text
}
deriving (CreateDataset -> CreateDataset -> Bool
(CreateDataset -> CreateDataset -> Bool)
-> (CreateDataset -> CreateDataset -> Bool) -> Eq CreateDataset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataset -> CreateDataset -> Bool
$c/= :: CreateDataset -> CreateDataset -> Bool
== :: CreateDataset -> CreateDataset -> Bool
$c== :: CreateDataset -> CreateDataset -> Bool
Prelude.Eq, ReadPrec [CreateDataset]
ReadPrec CreateDataset
Int -> ReadS CreateDataset
ReadS [CreateDataset]
(Int -> ReadS CreateDataset)
-> ReadS [CreateDataset]
-> ReadPrec CreateDataset
-> ReadPrec [CreateDataset]
-> Read CreateDataset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataset]
$creadListPrec :: ReadPrec [CreateDataset]
readPrec :: ReadPrec CreateDataset
$creadPrec :: ReadPrec CreateDataset
readList :: ReadS [CreateDataset]
$creadList :: ReadS [CreateDataset]
readsPrec :: Int -> ReadS CreateDataset
$creadsPrec :: Int -> ReadS CreateDataset
Prelude.Read, Int -> CreateDataset -> ShowS
[CreateDataset] -> ShowS
CreateDataset -> String
(Int -> CreateDataset -> ShowS)
-> (CreateDataset -> String)
-> ([CreateDataset] -> ShowS)
-> Show CreateDataset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataset] -> ShowS
$cshowList :: [CreateDataset] -> ShowS
show :: CreateDataset -> String
$cshow :: CreateDataset -> String
showsPrec :: Int -> CreateDataset -> ShowS
$cshowsPrec :: Int -> CreateDataset -> ShowS
Prelude.Show, (forall x. CreateDataset -> Rep CreateDataset x)
-> (forall x. Rep CreateDataset x -> CreateDataset)
-> Generic CreateDataset
forall x. Rep CreateDataset x -> CreateDataset
forall x. CreateDataset -> Rep CreateDataset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDataset x -> CreateDataset
$cfrom :: forall x. CreateDataset -> Rep CreateDataset x
Prelude.Generic)
newCreateDataset ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateDataset
newCreateDataset :: Text -> Text -> Text -> Text -> CreateDataset
newCreateDataset
Text
pName_
Text
pSchemaArn_
Text
pDatasetGroupArn_
Text
pDatasetType_ =
CreateDataset' :: Text -> Text -> Text -> Text -> CreateDataset
CreateDataset'
{ $sel:name:CreateDataset' :: Text
name = Text
pName_,
$sel:schemaArn:CreateDataset' :: Text
schemaArn = Text
pSchemaArn_,
$sel:datasetGroupArn:CreateDataset' :: Text
datasetGroupArn = Text
pDatasetGroupArn_,
$sel:datasetType:CreateDataset' :: Text
datasetType = Text
pDatasetType_
}
createDataset_name :: Lens.Lens' CreateDataset Prelude.Text
createDataset_name :: (Text -> f Text) -> CreateDataset -> f CreateDataset
createDataset_name = (CreateDataset -> Text)
-> (CreateDataset -> Text -> CreateDataset)
-> Lens CreateDataset CreateDataset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Text
name :: Text
$sel:name:CreateDataset' :: CreateDataset -> Text
name} -> Text
name) (\s :: CreateDataset
s@CreateDataset' {} Text
a -> CreateDataset
s {$sel:name:CreateDataset' :: Text
name = Text
a} :: CreateDataset)
createDataset_schemaArn :: Lens.Lens' CreateDataset Prelude.Text
createDataset_schemaArn :: (Text -> f Text) -> CreateDataset -> f CreateDataset
createDataset_schemaArn = (CreateDataset -> Text)
-> (CreateDataset -> Text -> CreateDataset)
-> Lens CreateDataset CreateDataset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Text
schemaArn :: Text
$sel:schemaArn:CreateDataset' :: CreateDataset -> Text
schemaArn} -> Text
schemaArn) (\s :: CreateDataset
s@CreateDataset' {} Text
a -> CreateDataset
s {$sel:schemaArn:CreateDataset' :: Text
schemaArn = Text
a} :: CreateDataset)
createDataset_datasetGroupArn :: Lens.Lens' CreateDataset Prelude.Text
createDataset_datasetGroupArn :: (Text -> f Text) -> CreateDataset -> f CreateDataset
createDataset_datasetGroupArn = (CreateDataset -> Text)
-> (CreateDataset -> Text -> CreateDataset)
-> Lens CreateDataset CreateDataset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Text
datasetGroupArn :: Text
$sel:datasetGroupArn:CreateDataset' :: CreateDataset -> Text
datasetGroupArn} -> Text
datasetGroupArn) (\s :: CreateDataset
s@CreateDataset' {} Text
a -> CreateDataset
s {$sel:datasetGroupArn:CreateDataset' :: Text
datasetGroupArn = Text
a} :: CreateDataset)
createDataset_datasetType :: Lens.Lens' CreateDataset Prelude.Text
createDataset_datasetType :: (Text -> f Text) -> CreateDataset -> f CreateDataset
createDataset_datasetType = (CreateDataset -> Text)
-> (CreateDataset -> Text -> CreateDataset)
-> Lens CreateDataset CreateDataset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Text
datasetType :: Text
$sel:datasetType:CreateDataset' :: CreateDataset -> Text
datasetType} -> Text
datasetType) (\s :: CreateDataset
s@CreateDataset' {} Text
a -> CreateDataset
s {$sel:datasetType:CreateDataset' :: Text
datasetType = Text
a} :: CreateDataset)
instance Core.AWSRequest CreateDataset where
type
AWSResponse CreateDataset =
CreateDatasetResponse
request :: CreateDataset -> Request CreateDataset
request = Service -> CreateDataset -> Request CreateDataset
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDataset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDataset)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDataset))
-> Logger
-> Service
-> Proxy CreateDataset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDataset)))
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 -> CreateDatasetResponse
CreateDatasetResponse'
(Maybe Text -> Int -> CreateDatasetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateDatasetResponse)
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
"datasetArn")
Either String (Int -> CreateDatasetResponse)
-> Either String Int -> Either String CreateDatasetResponse
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 CreateDataset
instance Prelude.NFData CreateDataset
instance Core.ToHeaders CreateDataset where
toHeaders :: CreateDataset -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDataset -> 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.CreateDataset" ::
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 CreateDataset where
toJSON :: CreateDataset -> Value
toJSON CreateDataset' {Text
datasetType :: Text
datasetGroupArn :: Text
schemaArn :: Text
name :: Text
$sel:datasetType:CreateDataset' :: CreateDataset -> Text
$sel:datasetGroupArn:CreateDataset' :: CreateDataset -> Text
$sel:schemaArn:CreateDataset' :: CreateDataset -> Text
$sel:name:CreateDataset' :: CreateDataset -> 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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"schemaArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
schemaArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"datasetGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetGroupArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"datasetType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetType)
]
)
instance Core.ToPath CreateDataset where
toPath :: CreateDataset -> ByteString
toPath = ByteString -> CreateDataset -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDataset where
toQuery :: CreateDataset -> QueryString
toQuery = QueryString -> CreateDataset -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateDatasetResponse = CreateDatasetResponse'
{
CreateDatasetResponse -> Maybe Text
datasetArn :: Prelude.Maybe Prelude.Text,
CreateDatasetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDatasetResponse -> CreateDatasetResponse -> Bool
(CreateDatasetResponse -> CreateDatasetResponse -> Bool)
-> (CreateDatasetResponse -> CreateDatasetResponse -> Bool)
-> Eq CreateDatasetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatasetResponse -> CreateDatasetResponse -> Bool
$c/= :: CreateDatasetResponse -> CreateDatasetResponse -> Bool
== :: CreateDatasetResponse -> CreateDatasetResponse -> Bool
$c== :: CreateDatasetResponse -> CreateDatasetResponse -> Bool
Prelude.Eq, ReadPrec [CreateDatasetResponse]
ReadPrec CreateDatasetResponse
Int -> ReadS CreateDatasetResponse
ReadS [CreateDatasetResponse]
(Int -> ReadS CreateDatasetResponse)
-> ReadS [CreateDatasetResponse]
-> ReadPrec CreateDatasetResponse
-> ReadPrec [CreateDatasetResponse]
-> Read CreateDatasetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDatasetResponse]
$creadListPrec :: ReadPrec [CreateDatasetResponse]
readPrec :: ReadPrec CreateDatasetResponse
$creadPrec :: ReadPrec CreateDatasetResponse
readList :: ReadS [CreateDatasetResponse]
$creadList :: ReadS [CreateDatasetResponse]
readsPrec :: Int -> ReadS CreateDatasetResponse
$creadsPrec :: Int -> ReadS CreateDatasetResponse
Prelude.Read, Int -> CreateDatasetResponse -> ShowS
[CreateDatasetResponse] -> ShowS
CreateDatasetResponse -> String
(Int -> CreateDatasetResponse -> ShowS)
-> (CreateDatasetResponse -> String)
-> ([CreateDatasetResponse] -> ShowS)
-> Show CreateDatasetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatasetResponse] -> ShowS
$cshowList :: [CreateDatasetResponse] -> ShowS
show :: CreateDatasetResponse -> String
$cshow :: CreateDatasetResponse -> String
showsPrec :: Int -> CreateDatasetResponse -> ShowS
$cshowsPrec :: Int -> CreateDatasetResponse -> ShowS
Prelude.Show, (forall x. CreateDatasetResponse -> Rep CreateDatasetResponse x)
-> (forall x. Rep CreateDatasetResponse x -> CreateDatasetResponse)
-> Generic CreateDatasetResponse
forall x. Rep CreateDatasetResponse x -> CreateDatasetResponse
forall x. CreateDatasetResponse -> Rep CreateDatasetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDatasetResponse x -> CreateDatasetResponse
$cfrom :: forall x. CreateDatasetResponse -> Rep CreateDatasetResponse x
Prelude.Generic)
newCreateDatasetResponse ::
Prelude.Int ->
CreateDatasetResponse
newCreateDatasetResponse :: Int -> CreateDatasetResponse
newCreateDatasetResponse Int
pHttpStatus_ =
CreateDatasetResponse' :: Maybe Text -> Int -> CreateDatasetResponse
CreateDatasetResponse'
{ $sel:datasetArn:CreateDatasetResponse' :: Maybe Text
datasetArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDatasetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDatasetResponse_datasetArn :: Lens.Lens' CreateDatasetResponse (Prelude.Maybe Prelude.Text)
createDatasetResponse_datasetArn :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetResponse -> f CreateDatasetResponse
createDatasetResponse_datasetArn = (CreateDatasetResponse -> Maybe Text)
-> (CreateDatasetResponse -> Maybe Text -> CreateDatasetResponse)
-> Lens
CreateDatasetResponse
CreateDatasetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetResponse' {Maybe Text
datasetArn :: Maybe Text
$sel:datasetArn:CreateDatasetResponse' :: CreateDatasetResponse -> Maybe Text
datasetArn} -> Maybe Text
datasetArn) (\s :: CreateDatasetResponse
s@CreateDatasetResponse' {} Maybe Text
a -> CreateDatasetResponse
s {$sel:datasetArn:CreateDatasetResponse' :: Maybe Text
datasetArn = Maybe Text
a} :: CreateDatasetResponse)
createDatasetResponse_httpStatus :: Lens.Lens' CreateDatasetResponse Prelude.Int
createDatasetResponse_httpStatus :: (Int -> f Int) -> CreateDatasetResponse -> f CreateDatasetResponse
createDatasetResponse_httpStatus = (CreateDatasetResponse -> Int)
-> (CreateDatasetResponse -> Int -> CreateDatasetResponse)
-> Lens CreateDatasetResponse CreateDatasetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDatasetResponse' :: CreateDatasetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDatasetResponse
s@CreateDatasetResponse' {} Int
a -> CreateDatasetResponse
s {$sel:httpStatus:CreateDatasetResponse' :: Int
httpStatus = Int
a} :: CreateDatasetResponse)
instance Prelude.NFData CreateDatasetResponse