{-# 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.CreateProject
(
CreateProject (..),
newCreateProject,
createProject_sample,
createProject_tags,
createProject_datasetName,
createProject_name,
createProject_recipeName,
createProject_roleArn,
CreateProjectResponse (..),
newCreateProjectResponse,
createProjectResponse_httpStatus,
createProjectResponse_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 CreateProject = CreateProject'
{ CreateProject -> Maybe Sample
sample :: Prelude.Maybe Sample,
CreateProject -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateProject -> Text
datasetName :: Prelude.Text,
CreateProject -> Text
name :: Prelude.Text,
CreateProject -> Text
recipeName :: Prelude.Text,
CreateProject -> Text
roleArn :: Prelude.Text
}
deriving (CreateProject -> CreateProject -> Bool
(CreateProject -> CreateProject -> Bool)
-> (CreateProject -> CreateProject -> Bool) -> Eq CreateProject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProject -> CreateProject -> Bool
$c/= :: CreateProject -> CreateProject -> Bool
== :: CreateProject -> CreateProject -> Bool
$c== :: CreateProject -> CreateProject -> Bool
Prelude.Eq, ReadPrec [CreateProject]
ReadPrec CreateProject
Int -> ReadS CreateProject
ReadS [CreateProject]
(Int -> ReadS CreateProject)
-> ReadS [CreateProject]
-> ReadPrec CreateProject
-> ReadPrec [CreateProject]
-> Read CreateProject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProject]
$creadListPrec :: ReadPrec [CreateProject]
readPrec :: ReadPrec CreateProject
$creadPrec :: ReadPrec CreateProject
readList :: ReadS [CreateProject]
$creadList :: ReadS [CreateProject]
readsPrec :: Int -> ReadS CreateProject
$creadsPrec :: Int -> ReadS CreateProject
Prelude.Read, Int -> CreateProject -> ShowS
[CreateProject] -> ShowS
CreateProject -> String
(Int -> CreateProject -> ShowS)
-> (CreateProject -> String)
-> ([CreateProject] -> ShowS)
-> Show CreateProject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProject] -> ShowS
$cshowList :: [CreateProject] -> ShowS
show :: CreateProject -> String
$cshow :: CreateProject -> String
showsPrec :: Int -> CreateProject -> ShowS
$cshowsPrec :: Int -> CreateProject -> ShowS
Prelude.Show, (forall x. CreateProject -> Rep CreateProject x)
-> (forall x. Rep CreateProject x -> CreateProject)
-> Generic CreateProject
forall x. Rep CreateProject x -> CreateProject
forall x. CreateProject -> Rep CreateProject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProject x -> CreateProject
$cfrom :: forall x. CreateProject -> Rep CreateProject x
Prelude.Generic)
newCreateProject ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateProject
newCreateProject :: Text -> Text -> Text -> Text -> CreateProject
newCreateProject
Text
pDatasetName_
Text
pName_
Text
pRecipeName_
Text
pRoleArn_ =
CreateProject' :: Maybe Sample
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> Text
-> CreateProject
CreateProject'
{ $sel:sample:CreateProject' :: Maybe Sample
sample = Maybe Sample
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateProject' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:datasetName:CreateProject' :: Text
datasetName = Text
pDatasetName_,
$sel:name:CreateProject' :: Text
name = Text
pName_,
$sel:recipeName:CreateProject' :: Text
recipeName = Text
pRecipeName_,
$sel:roleArn:CreateProject' :: Text
roleArn = Text
pRoleArn_
}
createProject_sample :: Lens.Lens' CreateProject (Prelude.Maybe Sample)
createProject_sample :: (Maybe Sample -> f (Maybe Sample))
-> CreateProject -> f CreateProject
createProject_sample = (CreateProject -> Maybe Sample)
-> (CreateProject -> Maybe Sample -> CreateProject)
-> Lens CreateProject CreateProject (Maybe Sample) (Maybe Sample)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProject' {Maybe Sample
sample :: Maybe Sample
$sel:sample:CreateProject' :: CreateProject -> Maybe Sample
sample} -> Maybe Sample
sample) (\s :: CreateProject
s@CreateProject' {} Maybe Sample
a -> CreateProject
s {$sel:sample:CreateProject' :: Maybe Sample
sample = Maybe Sample
a} :: CreateProject)
createProject_tags :: Lens.Lens' CreateProject (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createProject_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateProject -> f CreateProject
createProject_tags = (CreateProject -> Maybe (HashMap Text Text))
-> (CreateProject -> Maybe (HashMap Text Text) -> CreateProject)
-> Lens
CreateProject
CreateProject
(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 (\CreateProject' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateProject' :: CreateProject -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateProject
s@CreateProject' {} Maybe (HashMap Text Text)
a -> CreateProject
s {$sel:tags:CreateProject' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateProject) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateProject -> f CreateProject)
-> ((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)))
-> CreateProject
-> f CreateProject
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
createProject_datasetName :: Lens.Lens' CreateProject Prelude.Text
createProject_datasetName :: (Text -> f Text) -> CreateProject -> f CreateProject
createProject_datasetName = (CreateProject -> Text)
-> (CreateProject -> Text -> CreateProject)
-> Lens CreateProject CreateProject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProject' {Text
datasetName :: Text
$sel:datasetName:CreateProject' :: CreateProject -> Text
datasetName} -> Text
datasetName) (\s :: CreateProject
s@CreateProject' {} Text
a -> CreateProject
s {$sel:datasetName:CreateProject' :: Text
datasetName = Text
a} :: CreateProject)
createProject_name :: Lens.Lens' CreateProject Prelude.Text
createProject_name :: (Text -> f Text) -> CreateProject -> f CreateProject
createProject_name = (CreateProject -> Text)
-> (CreateProject -> Text -> CreateProject)
-> Lens CreateProject CreateProject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProject' {Text
name :: Text
$sel:name:CreateProject' :: CreateProject -> Text
name} -> Text
name) (\s :: CreateProject
s@CreateProject' {} Text
a -> CreateProject
s {$sel:name:CreateProject' :: Text
name = Text
a} :: CreateProject)
createProject_recipeName :: Lens.Lens' CreateProject Prelude.Text
createProject_recipeName :: (Text -> f Text) -> CreateProject -> f CreateProject
createProject_recipeName = (CreateProject -> Text)
-> (CreateProject -> Text -> CreateProject)
-> Lens CreateProject CreateProject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProject' {Text
recipeName :: Text
$sel:recipeName:CreateProject' :: CreateProject -> Text
recipeName} -> Text
recipeName) (\s :: CreateProject
s@CreateProject' {} Text
a -> CreateProject
s {$sel:recipeName:CreateProject' :: Text
recipeName = Text
a} :: CreateProject)
createProject_roleArn :: Lens.Lens' CreateProject Prelude.Text
createProject_roleArn :: (Text -> f Text) -> CreateProject -> f CreateProject
createProject_roleArn = (CreateProject -> Text)
-> (CreateProject -> Text -> CreateProject)
-> Lens CreateProject CreateProject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProject' {Text
roleArn :: Text
$sel:roleArn:CreateProject' :: CreateProject -> Text
roleArn} -> Text
roleArn) (\s :: CreateProject
s@CreateProject' {} Text
a -> CreateProject
s {$sel:roleArn:CreateProject' :: Text
roleArn = Text
a} :: CreateProject)
instance Core.AWSRequest CreateProject where
type
AWSResponse CreateProject =
CreateProjectResponse
request :: CreateProject -> Request CreateProject
request = Service -> CreateProject -> Request CreateProject
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateProject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProject)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateProject))
-> Logger
-> Service
-> Proxy CreateProject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProject)))
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 -> CreateProjectResponse
CreateProjectResponse'
(Int -> Text -> CreateProjectResponse)
-> Either String Int
-> Either String (Text -> CreateProjectResponse)
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 -> CreateProjectResponse)
-> Either String Text -> Either String CreateProjectResponse
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 CreateProject
instance Prelude.NFData CreateProject
instance Core.ToHeaders CreateProject where
toHeaders :: CreateProject -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateProject -> 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 CreateProject where
toJSON :: CreateProject -> Value
toJSON CreateProject' {Maybe (HashMap Text Text)
Maybe Sample
Text
roleArn :: Text
recipeName :: Text
name :: Text
datasetName :: Text
tags :: Maybe (HashMap Text Text)
sample :: Maybe Sample
$sel:roleArn:CreateProject' :: CreateProject -> Text
$sel:recipeName:CreateProject' :: CreateProject -> Text
$sel:name:CreateProject' :: CreateProject -> Text
$sel:datasetName:CreateProject' :: CreateProject -> Text
$sel:tags:CreateProject' :: CreateProject -> Maybe (HashMap Text Text)
$sel:sample:CreateProject' :: CreateProject -> Maybe Sample
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Sample" Text -> Sample -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sample -> Pair) -> Maybe Sample -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Sample
sample,
(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
"DatasetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetName),
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
"RecipeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
recipeName),
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 CreateProject where
toPath :: CreateProject -> ByteString
toPath = ByteString -> CreateProject -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/projects"
instance Core.ToQuery CreateProject where
toQuery :: CreateProject -> QueryString
toQuery = QueryString -> CreateProject -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateProjectResponse = CreateProjectResponse'
{
CreateProjectResponse -> Int
httpStatus :: Prelude.Int,
CreateProjectResponse -> Text
name :: Prelude.Text
}
deriving (CreateProjectResponse -> CreateProjectResponse -> Bool
(CreateProjectResponse -> CreateProjectResponse -> Bool)
-> (CreateProjectResponse -> CreateProjectResponse -> Bool)
-> Eq CreateProjectResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProjectResponse -> CreateProjectResponse -> Bool
$c/= :: CreateProjectResponse -> CreateProjectResponse -> Bool
== :: CreateProjectResponse -> CreateProjectResponse -> Bool
$c== :: CreateProjectResponse -> CreateProjectResponse -> Bool
Prelude.Eq, ReadPrec [CreateProjectResponse]
ReadPrec CreateProjectResponse
Int -> ReadS CreateProjectResponse
ReadS [CreateProjectResponse]
(Int -> ReadS CreateProjectResponse)
-> ReadS [CreateProjectResponse]
-> ReadPrec CreateProjectResponse
-> ReadPrec [CreateProjectResponse]
-> Read CreateProjectResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProjectResponse]
$creadListPrec :: ReadPrec [CreateProjectResponse]
readPrec :: ReadPrec CreateProjectResponse
$creadPrec :: ReadPrec CreateProjectResponse
readList :: ReadS [CreateProjectResponse]
$creadList :: ReadS [CreateProjectResponse]
readsPrec :: Int -> ReadS CreateProjectResponse
$creadsPrec :: Int -> ReadS CreateProjectResponse
Prelude.Read, Int -> CreateProjectResponse -> ShowS
[CreateProjectResponse] -> ShowS
CreateProjectResponse -> String
(Int -> CreateProjectResponse -> ShowS)
-> (CreateProjectResponse -> String)
-> ([CreateProjectResponse] -> ShowS)
-> Show CreateProjectResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProjectResponse] -> ShowS
$cshowList :: [CreateProjectResponse] -> ShowS
show :: CreateProjectResponse -> String
$cshow :: CreateProjectResponse -> String
showsPrec :: Int -> CreateProjectResponse -> ShowS
$cshowsPrec :: Int -> CreateProjectResponse -> ShowS
Prelude.Show, (forall x. CreateProjectResponse -> Rep CreateProjectResponse x)
-> (forall x. Rep CreateProjectResponse x -> CreateProjectResponse)
-> Generic CreateProjectResponse
forall x. Rep CreateProjectResponse x -> CreateProjectResponse
forall x. CreateProjectResponse -> Rep CreateProjectResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProjectResponse x -> CreateProjectResponse
$cfrom :: forall x. CreateProjectResponse -> Rep CreateProjectResponse x
Prelude.Generic)
newCreateProjectResponse ::
Prelude.Int ->
Prelude.Text ->
CreateProjectResponse
newCreateProjectResponse :: Int -> Text -> CreateProjectResponse
newCreateProjectResponse Int
pHttpStatus_ Text
pName_ =
CreateProjectResponse' :: Int -> Text -> CreateProjectResponse
CreateProjectResponse'
{ $sel:httpStatus:CreateProjectResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:name:CreateProjectResponse' :: Text
name = Text
pName_
}
createProjectResponse_httpStatus :: Lens.Lens' CreateProjectResponse Prelude.Int
createProjectResponse_httpStatus :: (Int -> f Int) -> CreateProjectResponse -> f CreateProjectResponse
createProjectResponse_httpStatus = (CreateProjectResponse -> Int)
-> (CreateProjectResponse -> Int -> CreateProjectResponse)
-> Lens CreateProjectResponse CreateProjectResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateProjectResponse' :: CreateProjectResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateProjectResponse
s@CreateProjectResponse' {} Int
a -> CreateProjectResponse
s {$sel:httpStatus:CreateProjectResponse' :: Int
httpStatus = Int
a} :: CreateProjectResponse)
createProjectResponse_name :: Lens.Lens' CreateProjectResponse Prelude.Text
createProjectResponse_name :: (Text -> f Text)
-> CreateProjectResponse -> f CreateProjectResponse
createProjectResponse_name = (CreateProjectResponse -> Text)
-> (CreateProjectResponse -> Text -> CreateProjectResponse)
-> Lens CreateProjectResponse CreateProjectResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectResponse' {Text
name :: Text
$sel:name:CreateProjectResponse' :: CreateProjectResponse -> Text
name} -> Text
name) (\s :: CreateProjectResponse
s@CreateProjectResponse' {} Text
a -> CreateProjectResponse
s {$sel:name:CreateProjectResponse' :: Text
name = Text
a} :: CreateProjectResponse)
instance Prelude.NFData CreateProjectResponse