{-# 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.CreateDatasetGroup
(
CreateDatasetGroup (..),
newCreateDatasetGroup,
createDatasetGroup_kmsKeyArn,
createDatasetGroup_roleArn,
createDatasetGroup_name,
CreateDatasetGroupResponse (..),
newCreateDatasetGroupResponse,
createDatasetGroupResponse_datasetGroupArn,
createDatasetGroupResponse_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 CreateDatasetGroup = CreateDatasetGroup'
{
CreateDatasetGroup -> Maybe Text
kmsKeyArn :: Prelude.Maybe Prelude.Text,
CreateDatasetGroup -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
CreateDatasetGroup -> Text
name :: Prelude.Text
}
deriving (CreateDatasetGroup -> CreateDatasetGroup -> Bool
(CreateDatasetGroup -> CreateDatasetGroup -> Bool)
-> (CreateDatasetGroup -> CreateDatasetGroup -> Bool)
-> Eq CreateDatasetGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatasetGroup -> CreateDatasetGroup -> Bool
$c/= :: CreateDatasetGroup -> CreateDatasetGroup -> Bool
== :: CreateDatasetGroup -> CreateDatasetGroup -> Bool
$c== :: CreateDatasetGroup -> CreateDatasetGroup -> Bool
Prelude.Eq, ReadPrec [CreateDatasetGroup]
ReadPrec CreateDatasetGroup
Int -> ReadS CreateDatasetGroup
ReadS [CreateDatasetGroup]
(Int -> ReadS CreateDatasetGroup)
-> ReadS [CreateDatasetGroup]
-> ReadPrec CreateDatasetGroup
-> ReadPrec [CreateDatasetGroup]
-> Read CreateDatasetGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDatasetGroup]
$creadListPrec :: ReadPrec [CreateDatasetGroup]
readPrec :: ReadPrec CreateDatasetGroup
$creadPrec :: ReadPrec CreateDatasetGroup
readList :: ReadS [CreateDatasetGroup]
$creadList :: ReadS [CreateDatasetGroup]
readsPrec :: Int -> ReadS CreateDatasetGroup
$creadsPrec :: Int -> ReadS CreateDatasetGroup
Prelude.Read, Int -> CreateDatasetGroup -> ShowS
[CreateDatasetGroup] -> ShowS
CreateDatasetGroup -> String
(Int -> CreateDatasetGroup -> ShowS)
-> (CreateDatasetGroup -> String)
-> ([CreateDatasetGroup] -> ShowS)
-> Show CreateDatasetGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatasetGroup] -> ShowS
$cshowList :: [CreateDatasetGroup] -> ShowS
show :: CreateDatasetGroup -> String
$cshow :: CreateDatasetGroup -> String
showsPrec :: Int -> CreateDatasetGroup -> ShowS
$cshowsPrec :: Int -> CreateDatasetGroup -> ShowS
Prelude.Show, (forall x. CreateDatasetGroup -> Rep CreateDatasetGroup x)
-> (forall x. Rep CreateDatasetGroup x -> CreateDatasetGroup)
-> Generic CreateDatasetGroup
forall x. Rep CreateDatasetGroup x -> CreateDatasetGroup
forall x. CreateDatasetGroup -> Rep CreateDatasetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDatasetGroup x -> CreateDatasetGroup
$cfrom :: forall x. CreateDatasetGroup -> Rep CreateDatasetGroup x
Prelude.Generic)
newCreateDatasetGroup ::
Prelude.Text ->
CreateDatasetGroup
newCreateDatasetGroup :: Text -> CreateDatasetGroup
newCreateDatasetGroup Text
pName_ =
CreateDatasetGroup' :: Maybe Text -> Maybe Text -> Text -> CreateDatasetGroup
CreateDatasetGroup'
{ $sel:kmsKeyArn:CreateDatasetGroup' :: Maybe Text
kmsKeyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:CreateDatasetGroup' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateDatasetGroup' :: Text
name = Text
pName_
}
createDatasetGroup_kmsKeyArn :: Lens.Lens' CreateDatasetGroup (Prelude.Maybe Prelude.Text)
createDatasetGroup_kmsKeyArn :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetGroup -> f CreateDatasetGroup
createDatasetGroup_kmsKeyArn = (CreateDatasetGroup -> Maybe Text)
-> (CreateDatasetGroup -> Maybe Text -> CreateDatasetGroup)
-> Lens
CreateDatasetGroup CreateDatasetGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetGroup' {Maybe Text
kmsKeyArn :: Maybe Text
$sel:kmsKeyArn:CreateDatasetGroup' :: CreateDatasetGroup -> Maybe Text
kmsKeyArn} -> Maybe Text
kmsKeyArn) (\s :: CreateDatasetGroup
s@CreateDatasetGroup' {} Maybe Text
a -> CreateDatasetGroup
s {$sel:kmsKeyArn:CreateDatasetGroup' :: Maybe Text
kmsKeyArn = Maybe Text
a} :: CreateDatasetGroup)
createDatasetGroup_roleArn :: Lens.Lens' CreateDatasetGroup (Prelude.Maybe Prelude.Text)
createDatasetGroup_roleArn :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetGroup -> f CreateDatasetGroup
createDatasetGroup_roleArn = (CreateDatasetGroup -> Maybe Text)
-> (CreateDatasetGroup -> Maybe Text -> CreateDatasetGroup)
-> Lens
CreateDatasetGroup CreateDatasetGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetGroup' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:CreateDatasetGroup' :: CreateDatasetGroup -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: CreateDatasetGroup
s@CreateDatasetGroup' {} Maybe Text
a -> CreateDatasetGroup
s {$sel:roleArn:CreateDatasetGroup' :: Maybe Text
roleArn = Maybe Text
a} :: CreateDatasetGroup)
createDatasetGroup_name :: Lens.Lens' CreateDatasetGroup Prelude.Text
createDatasetGroup_name :: (Text -> f Text) -> CreateDatasetGroup -> f CreateDatasetGroup
createDatasetGroup_name = (CreateDatasetGroup -> Text)
-> (CreateDatasetGroup -> Text -> CreateDatasetGroup)
-> Lens CreateDatasetGroup CreateDatasetGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetGroup' {Text
name :: Text
$sel:name:CreateDatasetGroup' :: CreateDatasetGroup -> Text
name} -> Text
name) (\s :: CreateDatasetGroup
s@CreateDatasetGroup' {} Text
a -> CreateDatasetGroup
s {$sel:name:CreateDatasetGroup' :: Text
name = Text
a} :: CreateDatasetGroup)
instance Core.AWSRequest CreateDatasetGroup where
type
AWSResponse CreateDatasetGroup =
CreateDatasetGroupResponse
request :: CreateDatasetGroup -> Request CreateDatasetGroup
request = Service -> CreateDatasetGroup -> Request CreateDatasetGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDatasetGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDatasetGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDatasetGroup))
-> Logger
-> Service
-> Proxy CreateDatasetGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDatasetGroup)))
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 -> CreateDatasetGroupResponse
CreateDatasetGroupResponse'
(Maybe Text -> Int -> CreateDatasetGroupResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateDatasetGroupResponse)
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
"datasetGroupArn")
Either String (Int -> CreateDatasetGroupResponse)
-> Either String Int -> Either String CreateDatasetGroupResponse
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 CreateDatasetGroup
instance Prelude.NFData CreateDatasetGroup
instance Core.ToHeaders CreateDatasetGroup where
toHeaders :: CreateDatasetGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDatasetGroup -> 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.CreateDatasetGroup" ::
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 CreateDatasetGroup where
toJSON :: CreateDatasetGroup -> Value
toJSON CreateDatasetGroup' {Maybe Text
Text
name :: Text
roleArn :: Maybe Text
kmsKeyArn :: Maybe Text
$sel:name:CreateDatasetGroup' :: CreateDatasetGroup -> Text
$sel:roleArn:CreateDatasetGroup' :: CreateDatasetGroup -> Maybe Text
$sel:kmsKeyArn:CreateDatasetGroup' :: CreateDatasetGroup -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"kmsKeyArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyArn,
(Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn,
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)
]
)
instance Core.ToPath CreateDatasetGroup where
toPath :: CreateDatasetGroup -> ByteString
toPath = ByteString -> CreateDatasetGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDatasetGroup where
toQuery :: CreateDatasetGroup -> QueryString
toQuery = QueryString -> CreateDatasetGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateDatasetGroupResponse = CreateDatasetGroupResponse'
{
CreateDatasetGroupResponse -> Maybe Text
datasetGroupArn :: Prelude.Maybe Prelude.Text,
CreateDatasetGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDatasetGroupResponse -> CreateDatasetGroupResponse -> Bool
(CreateDatasetGroupResponse -> CreateDatasetGroupResponse -> Bool)
-> (CreateDatasetGroupResponse
-> CreateDatasetGroupResponse -> Bool)
-> Eq CreateDatasetGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDatasetGroupResponse -> CreateDatasetGroupResponse -> Bool
$c/= :: CreateDatasetGroupResponse -> CreateDatasetGroupResponse -> Bool
== :: CreateDatasetGroupResponse -> CreateDatasetGroupResponse -> Bool
$c== :: CreateDatasetGroupResponse -> CreateDatasetGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateDatasetGroupResponse]
ReadPrec CreateDatasetGroupResponse
Int -> ReadS CreateDatasetGroupResponse
ReadS [CreateDatasetGroupResponse]
(Int -> ReadS CreateDatasetGroupResponse)
-> ReadS [CreateDatasetGroupResponse]
-> ReadPrec CreateDatasetGroupResponse
-> ReadPrec [CreateDatasetGroupResponse]
-> Read CreateDatasetGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDatasetGroupResponse]
$creadListPrec :: ReadPrec [CreateDatasetGroupResponse]
readPrec :: ReadPrec CreateDatasetGroupResponse
$creadPrec :: ReadPrec CreateDatasetGroupResponse
readList :: ReadS [CreateDatasetGroupResponse]
$creadList :: ReadS [CreateDatasetGroupResponse]
readsPrec :: Int -> ReadS CreateDatasetGroupResponse
$creadsPrec :: Int -> ReadS CreateDatasetGroupResponse
Prelude.Read, Int -> CreateDatasetGroupResponse -> ShowS
[CreateDatasetGroupResponse] -> ShowS
CreateDatasetGroupResponse -> String
(Int -> CreateDatasetGroupResponse -> ShowS)
-> (CreateDatasetGroupResponse -> String)
-> ([CreateDatasetGroupResponse] -> ShowS)
-> Show CreateDatasetGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDatasetGroupResponse] -> ShowS
$cshowList :: [CreateDatasetGroupResponse] -> ShowS
show :: CreateDatasetGroupResponse -> String
$cshow :: CreateDatasetGroupResponse -> String
showsPrec :: Int -> CreateDatasetGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateDatasetGroupResponse -> ShowS
Prelude.Show, (forall x.
CreateDatasetGroupResponse -> Rep CreateDatasetGroupResponse x)
-> (forall x.
Rep CreateDatasetGroupResponse x -> CreateDatasetGroupResponse)
-> Generic CreateDatasetGroupResponse
forall x.
Rep CreateDatasetGroupResponse x -> CreateDatasetGroupResponse
forall x.
CreateDatasetGroupResponse -> Rep CreateDatasetGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDatasetGroupResponse x -> CreateDatasetGroupResponse
$cfrom :: forall x.
CreateDatasetGroupResponse -> Rep CreateDatasetGroupResponse x
Prelude.Generic)
newCreateDatasetGroupResponse ::
Prelude.Int ->
CreateDatasetGroupResponse
newCreateDatasetGroupResponse :: Int -> CreateDatasetGroupResponse
newCreateDatasetGroupResponse Int
pHttpStatus_ =
CreateDatasetGroupResponse' :: Maybe Text -> Int -> CreateDatasetGroupResponse
CreateDatasetGroupResponse'
{ $sel:datasetGroupArn:CreateDatasetGroupResponse' :: Maybe Text
datasetGroupArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDatasetGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDatasetGroupResponse_datasetGroupArn :: Lens.Lens' CreateDatasetGroupResponse (Prelude.Maybe Prelude.Text)
createDatasetGroupResponse_datasetGroupArn :: (Maybe Text -> f (Maybe Text))
-> CreateDatasetGroupResponse -> f CreateDatasetGroupResponse
createDatasetGroupResponse_datasetGroupArn = (CreateDatasetGroupResponse -> Maybe Text)
-> (CreateDatasetGroupResponse
-> Maybe Text -> CreateDatasetGroupResponse)
-> Lens
CreateDatasetGroupResponse
CreateDatasetGroupResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetGroupResponse' {Maybe Text
datasetGroupArn :: Maybe Text
$sel:datasetGroupArn:CreateDatasetGroupResponse' :: CreateDatasetGroupResponse -> Maybe Text
datasetGroupArn} -> Maybe Text
datasetGroupArn) (\s :: CreateDatasetGroupResponse
s@CreateDatasetGroupResponse' {} Maybe Text
a -> CreateDatasetGroupResponse
s {$sel:datasetGroupArn:CreateDatasetGroupResponse' :: Maybe Text
datasetGroupArn = Maybe Text
a} :: CreateDatasetGroupResponse)
createDatasetGroupResponse_httpStatus :: Lens.Lens' CreateDatasetGroupResponse Prelude.Int
createDatasetGroupResponse_httpStatus :: (Int -> f Int)
-> CreateDatasetGroupResponse -> f CreateDatasetGroupResponse
createDatasetGroupResponse_httpStatus = (CreateDatasetGroupResponse -> Int)
-> (CreateDatasetGroupResponse
-> Int -> CreateDatasetGroupResponse)
-> Lens
CreateDatasetGroupResponse CreateDatasetGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDatasetGroupResponse' :: CreateDatasetGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDatasetGroupResponse
s@CreateDatasetGroupResponse' {} Int
a -> CreateDatasetGroupResponse
s {$sel:httpStatus:CreateDatasetGroupResponse' :: Int
httpStatus = Int
a} :: CreateDatasetGroupResponse)
instance Prelude.NFData CreateDatasetGroupResponse