{-# 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.Glue.CreateScript
(
CreateScript (..),
newCreateScript,
createScript_dagEdges,
createScript_language,
createScript_dagNodes,
CreateScriptResponse (..),
newCreateScriptResponse,
createScriptResponse_pythonScript,
createScriptResponse_scalaCode,
createScriptResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Glue.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 CreateScript = CreateScript'
{
CreateScript -> Maybe [CodeGenEdge]
dagEdges :: Prelude.Maybe [CodeGenEdge],
CreateScript -> Maybe Language
language :: Prelude.Maybe Language,
CreateScript -> Maybe [CodeGenNode]
dagNodes :: Prelude.Maybe [CodeGenNode]
}
deriving (CreateScript -> CreateScript -> Bool
(CreateScript -> CreateScript -> Bool)
-> (CreateScript -> CreateScript -> Bool) -> Eq CreateScript
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateScript -> CreateScript -> Bool
$c/= :: CreateScript -> CreateScript -> Bool
== :: CreateScript -> CreateScript -> Bool
$c== :: CreateScript -> CreateScript -> Bool
Prelude.Eq, ReadPrec [CreateScript]
ReadPrec CreateScript
Int -> ReadS CreateScript
ReadS [CreateScript]
(Int -> ReadS CreateScript)
-> ReadS [CreateScript]
-> ReadPrec CreateScript
-> ReadPrec [CreateScript]
-> Read CreateScript
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateScript]
$creadListPrec :: ReadPrec [CreateScript]
readPrec :: ReadPrec CreateScript
$creadPrec :: ReadPrec CreateScript
readList :: ReadS [CreateScript]
$creadList :: ReadS [CreateScript]
readsPrec :: Int -> ReadS CreateScript
$creadsPrec :: Int -> ReadS CreateScript
Prelude.Read, Int -> CreateScript -> ShowS
[CreateScript] -> ShowS
CreateScript -> String
(Int -> CreateScript -> ShowS)
-> (CreateScript -> String)
-> ([CreateScript] -> ShowS)
-> Show CreateScript
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateScript] -> ShowS
$cshowList :: [CreateScript] -> ShowS
show :: CreateScript -> String
$cshow :: CreateScript -> String
showsPrec :: Int -> CreateScript -> ShowS
$cshowsPrec :: Int -> CreateScript -> ShowS
Prelude.Show, (forall x. CreateScript -> Rep CreateScript x)
-> (forall x. Rep CreateScript x -> CreateScript)
-> Generic CreateScript
forall x. Rep CreateScript x -> CreateScript
forall x. CreateScript -> Rep CreateScript x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateScript x -> CreateScript
$cfrom :: forall x. CreateScript -> Rep CreateScript x
Prelude.Generic)
newCreateScript ::
CreateScript
newCreateScript :: CreateScript
newCreateScript =
CreateScript' :: Maybe [CodeGenEdge]
-> Maybe Language -> Maybe [CodeGenNode] -> CreateScript
CreateScript'
{ $sel:dagEdges:CreateScript' :: Maybe [CodeGenEdge]
dagEdges = Maybe [CodeGenEdge]
forall a. Maybe a
Prelude.Nothing,
$sel:language:CreateScript' :: Maybe Language
language = Maybe Language
forall a. Maybe a
Prelude.Nothing,
$sel:dagNodes:CreateScript' :: Maybe [CodeGenNode]
dagNodes = Maybe [CodeGenNode]
forall a. Maybe a
Prelude.Nothing
}
createScript_dagEdges :: Lens.Lens' CreateScript (Prelude.Maybe [CodeGenEdge])
createScript_dagEdges :: (Maybe [CodeGenEdge] -> f (Maybe [CodeGenEdge]))
-> CreateScript -> f CreateScript
createScript_dagEdges = (CreateScript -> Maybe [CodeGenEdge])
-> (CreateScript -> Maybe [CodeGenEdge] -> CreateScript)
-> Lens
CreateScript
CreateScript
(Maybe [CodeGenEdge])
(Maybe [CodeGenEdge])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScript' {Maybe [CodeGenEdge]
dagEdges :: Maybe [CodeGenEdge]
$sel:dagEdges:CreateScript' :: CreateScript -> Maybe [CodeGenEdge]
dagEdges} -> Maybe [CodeGenEdge]
dagEdges) (\s :: CreateScript
s@CreateScript' {} Maybe [CodeGenEdge]
a -> CreateScript
s {$sel:dagEdges:CreateScript' :: Maybe [CodeGenEdge]
dagEdges = Maybe [CodeGenEdge]
a} :: CreateScript) ((Maybe [CodeGenEdge] -> f (Maybe [CodeGenEdge]))
-> CreateScript -> f CreateScript)
-> ((Maybe [CodeGenEdge] -> f (Maybe [CodeGenEdge]))
-> Maybe [CodeGenEdge] -> f (Maybe [CodeGenEdge]))
-> (Maybe [CodeGenEdge] -> f (Maybe [CodeGenEdge]))
-> CreateScript
-> f CreateScript
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CodeGenEdge] [CodeGenEdge] [CodeGenEdge] [CodeGenEdge]
-> Iso
(Maybe [CodeGenEdge])
(Maybe [CodeGenEdge])
(Maybe [CodeGenEdge])
(Maybe [CodeGenEdge])
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 [CodeGenEdge] [CodeGenEdge] [CodeGenEdge] [CodeGenEdge]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createScript_language :: Lens.Lens' CreateScript (Prelude.Maybe Language)
createScript_language :: (Maybe Language -> f (Maybe Language))
-> CreateScript -> f CreateScript
createScript_language = (CreateScript -> Maybe Language)
-> (CreateScript -> Maybe Language -> CreateScript)
-> Lens CreateScript CreateScript (Maybe Language) (Maybe Language)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScript' {Maybe Language
language :: Maybe Language
$sel:language:CreateScript' :: CreateScript -> Maybe Language
language} -> Maybe Language
language) (\s :: CreateScript
s@CreateScript' {} Maybe Language
a -> CreateScript
s {$sel:language:CreateScript' :: Maybe Language
language = Maybe Language
a} :: CreateScript)
createScript_dagNodes :: Lens.Lens' CreateScript (Prelude.Maybe [CodeGenNode])
createScript_dagNodes :: (Maybe [CodeGenNode] -> f (Maybe [CodeGenNode]))
-> CreateScript -> f CreateScript
createScript_dagNodes = (CreateScript -> Maybe [CodeGenNode])
-> (CreateScript -> Maybe [CodeGenNode] -> CreateScript)
-> Lens
CreateScript
CreateScript
(Maybe [CodeGenNode])
(Maybe [CodeGenNode])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScript' {Maybe [CodeGenNode]
dagNodes :: Maybe [CodeGenNode]
$sel:dagNodes:CreateScript' :: CreateScript -> Maybe [CodeGenNode]
dagNodes} -> Maybe [CodeGenNode]
dagNodes) (\s :: CreateScript
s@CreateScript' {} Maybe [CodeGenNode]
a -> CreateScript
s {$sel:dagNodes:CreateScript' :: Maybe [CodeGenNode]
dagNodes = Maybe [CodeGenNode]
a} :: CreateScript) ((Maybe [CodeGenNode] -> f (Maybe [CodeGenNode]))
-> CreateScript -> f CreateScript)
-> ((Maybe [CodeGenNode] -> f (Maybe [CodeGenNode]))
-> Maybe [CodeGenNode] -> f (Maybe [CodeGenNode]))
-> (Maybe [CodeGenNode] -> f (Maybe [CodeGenNode]))
-> CreateScript
-> f CreateScript
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CodeGenNode] [CodeGenNode] [CodeGenNode] [CodeGenNode]
-> Iso
(Maybe [CodeGenNode])
(Maybe [CodeGenNode])
(Maybe [CodeGenNode])
(Maybe [CodeGenNode])
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 [CodeGenNode] [CodeGenNode] [CodeGenNode] [CodeGenNode]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateScript where
type AWSResponse CreateScript = CreateScriptResponse
request :: CreateScript -> Request CreateScript
request = Service -> CreateScript -> Request CreateScript
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateScript
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateScript)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateScript))
-> Logger
-> Service
-> Proxy CreateScript
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateScript)))
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 -> Maybe Text -> Int -> CreateScriptResponse
CreateScriptResponse'
(Maybe Text -> Maybe Text -> Int -> CreateScriptResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateScriptResponse)
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
"PythonScript")
Either String (Maybe Text -> Int -> CreateScriptResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateScriptResponse)
forall (f :: * -> *) a b. Applicative f => 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
"ScalaCode")
Either String (Int -> CreateScriptResponse)
-> Either String Int -> Either String CreateScriptResponse
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 CreateScript
instance Prelude.NFData CreateScript
instance Core.ToHeaders CreateScript where
toHeaders :: CreateScript -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateScript -> 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
"AWSGlue.CreateScript" :: 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 CreateScript where
toJSON :: CreateScript -> Value
toJSON CreateScript' {Maybe [CodeGenEdge]
Maybe [CodeGenNode]
Maybe Language
dagNodes :: Maybe [CodeGenNode]
language :: Maybe Language
dagEdges :: Maybe [CodeGenEdge]
$sel:dagNodes:CreateScript' :: CreateScript -> Maybe [CodeGenNode]
$sel:language:CreateScript' :: CreateScript -> Maybe Language
$sel:dagEdges:CreateScript' :: CreateScript -> Maybe [CodeGenEdge]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DagEdges" Text -> [CodeGenEdge] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CodeGenEdge] -> Pair) -> Maybe [CodeGenEdge] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CodeGenEdge]
dagEdges,
(Text
"Language" Text -> Language -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Language -> Pair) -> Maybe Language -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Language
language,
(Text
"DagNodes" Text -> [CodeGenNode] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CodeGenNode] -> Pair) -> Maybe [CodeGenNode] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CodeGenNode]
dagNodes
]
)
instance Core.ToPath CreateScript where
toPath :: CreateScript -> ByteString
toPath = ByteString -> CreateScript -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateScript where
toQuery :: CreateScript -> QueryString
toQuery = QueryString -> CreateScript -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateScriptResponse = CreateScriptResponse'
{
CreateScriptResponse -> Maybe Text
pythonScript :: Prelude.Maybe Prelude.Text,
CreateScriptResponse -> Maybe Text
scalaCode :: Prelude.Maybe Prelude.Text,
CreateScriptResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateScriptResponse -> CreateScriptResponse -> Bool
(CreateScriptResponse -> CreateScriptResponse -> Bool)
-> (CreateScriptResponse -> CreateScriptResponse -> Bool)
-> Eq CreateScriptResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateScriptResponse -> CreateScriptResponse -> Bool
$c/= :: CreateScriptResponse -> CreateScriptResponse -> Bool
== :: CreateScriptResponse -> CreateScriptResponse -> Bool
$c== :: CreateScriptResponse -> CreateScriptResponse -> Bool
Prelude.Eq, ReadPrec [CreateScriptResponse]
ReadPrec CreateScriptResponse
Int -> ReadS CreateScriptResponse
ReadS [CreateScriptResponse]
(Int -> ReadS CreateScriptResponse)
-> ReadS [CreateScriptResponse]
-> ReadPrec CreateScriptResponse
-> ReadPrec [CreateScriptResponse]
-> Read CreateScriptResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateScriptResponse]
$creadListPrec :: ReadPrec [CreateScriptResponse]
readPrec :: ReadPrec CreateScriptResponse
$creadPrec :: ReadPrec CreateScriptResponse
readList :: ReadS [CreateScriptResponse]
$creadList :: ReadS [CreateScriptResponse]
readsPrec :: Int -> ReadS CreateScriptResponse
$creadsPrec :: Int -> ReadS CreateScriptResponse
Prelude.Read, Int -> CreateScriptResponse -> ShowS
[CreateScriptResponse] -> ShowS
CreateScriptResponse -> String
(Int -> CreateScriptResponse -> ShowS)
-> (CreateScriptResponse -> String)
-> ([CreateScriptResponse] -> ShowS)
-> Show CreateScriptResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateScriptResponse] -> ShowS
$cshowList :: [CreateScriptResponse] -> ShowS
show :: CreateScriptResponse -> String
$cshow :: CreateScriptResponse -> String
showsPrec :: Int -> CreateScriptResponse -> ShowS
$cshowsPrec :: Int -> CreateScriptResponse -> ShowS
Prelude.Show, (forall x. CreateScriptResponse -> Rep CreateScriptResponse x)
-> (forall x. Rep CreateScriptResponse x -> CreateScriptResponse)
-> Generic CreateScriptResponse
forall x. Rep CreateScriptResponse x -> CreateScriptResponse
forall x. CreateScriptResponse -> Rep CreateScriptResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateScriptResponse x -> CreateScriptResponse
$cfrom :: forall x. CreateScriptResponse -> Rep CreateScriptResponse x
Prelude.Generic)
newCreateScriptResponse ::
Prelude.Int ->
CreateScriptResponse
newCreateScriptResponse :: Int -> CreateScriptResponse
newCreateScriptResponse Int
pHttpStatus_ =
CreateScriptResponse' :: Maybe Text -> Maybe Text -> Int -> CreateScriptResponse
CreateScriptResponse'
{ $sel:pythonScript:CreateScriptResponse' :: Maybe Text
pythonScript =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:scalaCode:CreateScriptResponse' :: Maybe Text
scalaCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateScriptResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createScriptResponse_pythonScript :: Lens.Lens' CreateScriptResponse (Prelude.Maybe Prelude.Text)
createScriptResponse_pythonScript :: (Maybe Text -> f (Maybe Text))
-> CreateScriptResponse -> f CreateScriptResponse
createScriptResponse_pythonScript = (CreateScriptResponse -> Maybe Text)
-> (CreateScriptResponse -> Maybe Text -> CreateScriptResponse)
-> Lens
CreateScriptResponse CreateScriptResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScriptResponse' {Maybe Text
pythonScript :: Maybe Text
$sel:pythonScript:CreateScriptResponse' :: CreateScriptResponse -> Maybe Text
pythonScript} -> Maybe Text
pythonScript) (\s :: CreateScriptResponse
s@CreateScriptResponse' {} Maybe Text
a -> CreateScriptResponse
s {$sel:pythonScript:CreateScriptResponse' :: Maybe Text
pythonScript = Maybe Text
a} :: CreateScriptResponse)
createScriptResponse_scalaCode :: Lens.Lens' CreateScriptResponse (Prelude.Maybe Prelude.Text)
createScriptResponse_scalaCode :: (Maybe Text -> f (Maybe Text))
-> CreateScriptResponse -> f CreateScriptResponse
createScriptResponse_scalaCode = (CreateScriptResponse -> Maybe Text)
-> (CreateScriptResponse -> Maybe Text -> CreateScriptResponse)
-> Lens
CreateScriptResponse CreateScriptResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScriptResponse' {Maybe Text
scalaCode :: Maybe Text
$sel:scalaCode:CreateScriptResponse' :: CreateScriptResponse -> Maybe Text
scalaCode} -> Maybe Text
scalaCode) (\s :: CreateScriptResponse
s@CreateScriptResponse' {} Maybe Text
a -> CreateScriptResponse
s {$sel:scalaCode:CreateScriptResponse' :: Maybe Text
scalaCode = Maybe Text
a} :: CreateScriptResponse)
createScriptResponse_httpStatus :: Lens.Lens' CreateScriptResponse Prelude.Int
createScriptResponse_httpStatus :: (Int -> f Int) -> CreateScriptResponse -> f CreateScriptResponse
createScriptResponse_httpStatus = (CreateScriptResponse -> Int)
-> (CreateScriptResponse -> Int -> CreateScriptResponse)
-> Lens CreateScriptResponse CreateScriptResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScriptResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateScriptResponse' :: CreateScriptResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateScriptResponse
s@CreateScriptResponse' {} Int
a -> CreateScriptResponse
s {$sel:httpStatus:CreateScriptResponse' :: Int
httpStatus = Int
a} :: CreateScriptResponse)
instance Prelude.NFData CreateScriptResponse