{-# 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.DataBrew.CreateDataset
(
CreateDataset (..),
newCreateDataset,
createDataset_pathOptions,
createDataset_formatOptions,
createDataset_format,
createDataset_tags,
createDataset_name,
createDataset_input,
CreateDatasetResponse (..),
newCreateDatasetResponse,
createDatasetResponse_httpStatus,
createDatasetResponse_name,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DataBrew.Types
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 CreateDataset = CreateDataset'
{
CreateDataset -> Maybe PathOptions
pathOptions :: Prelude.Maybe PathOptions,
CreateDataset -> Maybe FormatOptions
formatOptions :: Prelude.Maybe FormatOptions,
CreateDataset -> Maybe InputFormat
format :: Prelude.Maybe InputFormat,
CreateDataset -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateDataset -> Text
name :: Prelude.Text,
CreateDataset -> Input
input :: Input
}
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 ->
Input ->
CreateDataset
newCreateDataset :: Text -> Input -> CreateDataset
newCreateDataset Text
pName_ Input
pInput_ =
CreateDataset' :: Maybe PathOptions
-> Maybe FormatOptions
-> Maybe InputFormat
-> Maybe (HashMap Text Text)
-> Text
-> Input
-> CreateDataset
CreateDataset'
{ $sel:pathOptions:CreateDataset' :: Maybe PathOptions
pathOptions = Maybe PathOptions
forall a. Maybe a
Prelude.Nothing,
$sel:formatOptions:CreateDataset' :: Maybe FormatOptions
formatOptions = Maybe FormatOptions
forall a. Maybe a
Prelude.Nothing,
$sel:format:CreateDataset' :: Maybe InputFormat
format = Maybe InputFormat
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateDataset' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateDataset' :: Text
name = Text
pName_,
$sel:input:CreateDataset' :: Input
input = Input
pInput_
}
createDataset_pathOptions :: Lens.Lens' CreateDataset (Prelude.Maybe PathOptions)
createDataset_pathOptions :: (Maybe PathOptions -> f (Maybe PathOptions))
-> CreateDataset -> f CreateDataset
createDataset_pathOptions = (CreateDataset -> Maybe PathOptions)
-> (CreateDataset -> Maybe PathOptions -> CreateDataset)
-> Lens
CreateDataset CreateDataset (Maybe PathOptions) (Maybe PathOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Maybe PathOptions
pathOptions :: Maybe PathOptions
$sel:pathOptions:CreateDataset' :: CreateDataset -> Maybe PathOptions
pathOptions} -> Maybe PathOptions
pathOptions) (\s :: CreateDataset
s@CreateDataset' {} Maybe PathOptions
a -> CreateDataset
s {$sel:pathOptions:CreateDataset' :: Maybe PathOptions
pathOptions = Maybe PathOptions
a} :: CreateDataset)
createDataset_formatOptions :: Lens.Lens' CreateDataset (Prelude.Maybe FormatOptions)
createDataset_formatOptions :: (Maybe FormatOptions -> f (Maybe FormatOptions))
-> CreateDataset -> f CreateDataset
createDataset_formatOptions = (CreateDataset -> Maybe FormatOptions)
-> (CreateDataset -> Maybe FormatOptions -> CreateDataset)
-> Lens
CreateDataset
CreateDataset
(Maybe FormatOptions)
(Maybe FormatOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Maybe FormatOptions
formatOptions :: Maybe FormatOptions
$sel:formatOptions:CreateDataset' :: CreateDataset -> Maybe FormatOptions
formatOptions} -> Maybe FormatOptions
formatOptions) (\s :: CreateDataset
s@CreateDataset' {} Maybe FormatOptions
a -> CreateDataset
s {$sel:formatOptions:CreateDataset' :: Maybe FormatOptions
formatOptions = Maybe FormatOptions
a} :: CreateDataset)
createDataset_format :: Lens.Lens' CreateDataset (Prelude.Maybe InputFormat)
createDataset_format :: (Maybe InputFormat -> f (Maybe InputFormat))
-> CreateDataset -> f CreateDataset
createDataset_format = (CreateDataset -> Maybe InputFormat)
-> (CreateDataset -> Maybe InputFormat -> CreateDataset)
-> Lens
CreateDataset CreateDataset (Maybe InputFormat) (Maybe InputFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Maybe InputFormat
format :: Maybe InputFormat
$sel:format:CreateDataset' :: CreateDataset -> Maybe InputFormat
format} -> Maybe InputFormat
format) (\s :: CreateDataset
s@CreateDataset' {} Maybe InputFormat
a -> CreateDataset
s {$sel:format:CreateDataset' :: Maybe InputFormat
format = Maybe InputFormat
a} :: CreateDataset)
createDataset_tags :: Lens.Lens' CreateDataset (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDataset_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDataset -> f CreateDataset
createDataset_tags = (CreateDataset -> Maybe (HashMap Text Text))
-> (CreateDataset -> Maybe (HashMap Text Text) -> CreateDataset)
-> Lens
CreateDataset
CreateDataset
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateDataset' :: CreateDataset -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateDataset
s@CreateDataset' {} Maybe (HashMap Text Text)
a -> CreateDataset
s {$sel:tags:CreateDataset' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateDataset) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDataset -> f CreateDataset)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDataset
-> f CreateDataset
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
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_input :: Lens.Lens' CreateDataset Input
createDataset_input :: (Input -> f Input) -> CreateDataset -> f CreateDataset
createDataset_input = (CreateDataset -> Input)
-> (CreateDataset -> Input -> CreateDataset)
-> Lens CreateDataset CreateDataset Input Input
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataset' {Input
input :: Input
$sel:input:CreateDataset' :: CreateDataset -> Input
input} -> Input
input) (\s :: CreateDataset
s@CreateDataset' {} Input
a -> CreateDataset
s {$sel:input:CreateDataset' :: Input
input = Input
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 ->
Int -> Text -> CreateDatasetResponse
CreateDatasetResponse'
(Int -> Text -> CreateDatasetResponse)
-> Either String Int
-> Either String (Text -> CreateDatasetResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Text -> CreateDatasetResponse)
-> Either String Text -> Either String CreateDatasetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Name")
)
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
"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' {Maybe (HashMap Text Text)
Maybe InputFormat
Maybe FormatOptions
Maybe PathOptions
Text
Input
input :: Input
name :: Text
tags :: Maybe (HashMap Text Text)
format :: Maybe InputFormat
formatOptions :: Maybe FormatOptions
pathOptions :: Maybe PathOptions
$sel:input:CreateDataset' :: CreateDataset -> Input
$sel:name:CreateDataset' :: CreateDataset -> Text
$sel:tags:CreateDataset' :: CreateDataset -> Maybe (HashMap Text Text)
$sel:format:CreateDataset' :: CreateDataset -> Maybe InputFormat
$sel:formatOptions:CreateDataset' :: CreateDataset -> Maybe FormatOptions
$sel:pathOptions:CreateDataset' :: CreateDataset -> Maybe PathOptions
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PathOptions" Text -> PathOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PathOptions -> Pair) -> Maybe PathOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PathOptions
pathOptions,
(Text
"FormatOptions" Text -> FormatOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FormatOptions -> Pair) -> Maybe FormatOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FormatOptions
formatOptions,
(Text
"Format" Text -> InputFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (InputFormat -> Pair) -> Maybe InputFormat -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputFormat
format,
(Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
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
"Input" Text -> Input -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Input
input)
]
)
instance Core.ToPath CreateDataset where
toPath :: CreateDataset -> ByteString
toPath = ByteString -> CreateDataset -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/datasets"
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 -> Int
httpStatus :: Prelude.Int,
CreateDatasetResponse -> Text
name :: Prelude.Text
}
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 ->
Prelude.Text ->
CreateDatasetResponse
newCreateDatasetResponse :: Int -> Text -> CreateDatasetResponse
newCreateDatasetResponse Int
pHttpStatus_ Text
pName_ =
CreateDatasetResponse' :: Int -> Text -> CreateDatasetResponse
CreateDatasetResponse'
{ $sel:httpStatus:CreateDatasetResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:name:CreateDatasetResponse' :: Text
name = Text
pName_
}
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)
createDatasetResponse_name :: Lens.Lens' CreateDatasetResponse Prelude.Text
createDatasetResponse_name :: (Text -> f Text)
-> CreateDatasetResponse -> f CreateDatasetResponse
createDatasetResponse_name = (CreateDatasetResponse -> Text)
-> (CreateDatasetResponse -> Text -> CreateDatasetResponse)
-> Lens CreateDatasetResponse CreateDatasetResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDatasetResponse' {Text
name :: Text
$sel:name:CreateDatasetResponse' :: CreateDatasetResponse -> Text
name} -> Text
name) (\s :: CreateDatasetResponse
s@CreateDatasetResponse' {} Text
a -> CreateDatasetResponse
s {$sel:name:CreateDatasetResponse' :: Text
name = Text
a} :: CreateDatasetResponse)
instance Prelude.NFData CreateDatasetResponse