{-# 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.EMR.AddJobFlowSteps
(
AddJobFlowSteps (..),
newAddJobFlowSteps,
addJobFlowSteps_jobFlowId,
addJobFlowSteps_steps,
AddJobFlowStepsResponse (..),
newAddJobFlowStepsResponse,
addJobFlowStepsResponse_stepIds,
addJobFlowStepsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EMR.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 AddJobFlowSteps = AddJobFlowSteps'
{
AddJobFlowSteps -> Text
jobFlowId :: Prelude.Text,
AddJobFlowSteps -> [StepConfig]
steps :: [StepConfig]
}
deriving (AddJobFlowSteps -> AddJobFlowSteps -> Bool
(AddJobFlowSteps -> AddJobFlowSteps -> Bool)
-> (AddJobFlowSteps -> AddJobFlowSteps -> Bool)
-> Eq AddJobFlowSteps
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddJobFlowSteps -> AddJobFlowSteps -> Bool
$c/= :: AddJobFlowSteps -> AddJobFlowSteps -> Bool
== :: AddJobFlowSteps -> AddJobFlowSteps -> Bool
$c== :: AddJobFlowSteps -> AddJobFlowSteps -> Bool
Prelude.Eq, ReadPrec [AddJobFlowSteps]
ReadPrec AddJobFlowSteps
Int -> ReadS AddJobFlowSteps
ReadS [AddJobFlowSteps]
(Int -> ReadS AddJobFlowSteps)
-> ReadS [AddJobFlowSteps]
-> ReadPrec AddJobFlowSteps
-> ReadPrec [AddJobFlowSteps]
-> Read AddJobFlowSteps
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddJobFlowSteps]
$creadListPrec :: ReadPrec [AddJobFlowSteps]
readPrec :: ReadPrec AddJobFlowSteps
$creadPrec :: ReadPrec AddJobFlowSteps
readList :: ReadS [AddJobFlowSteps]
$creadList :: ReadS [AddJobFlowSteps]
readsPrec :: Int -> ReadS AddJobFlowSteps
$creadsPrec :: Int -> ReadS AddJobFlowSteps
Prelude.Read, Int -> AddJobFlowSteps -> ShowS
[AddJobFlowSteps] -> ShowS
AddJobFlowSteps -> String
(Int -> AddJobFlowSteps -> ShowS)
-> (AddJobFlowSteps -> String)
-> ([AddJobFlowSteps] -> ShowS)
-> Show AddJobFlowSteps
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddJobFlowSteps] -> ShowS
$cshowList :: [AddJobFlowSteps] -> ShowS
show :: AddJobFlowSteps -> String
$cshow :: AddJobFlowSteps -> String
showsPrec :: Int -> AddJobFlowSteps -> ShowS
$cshowsPrec :: Int -> AddJobFlowSteps -> ShowS
Prelude.Show, (forall x. AddJobFlowSteps -> Rep AddJobFlowSteps x)
-> (forall x. Rep AddJobFlowSteps x -> AddJobFlowSteps)
-> Generic AddJobFlowSteps
forall x. Rep AddJobFlowSteps x -> AddJobFlowSteps
forall x. AddJobFlowSteps -> Rep AddJobFlowSteps x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddJobFlowSteps x -> AddJobFlowSteps
$cfrom :: forall x. AddJobFlowSteps -> Rep AddJobFlowSteps x
Prelude.Generic)
newAddJobFlowSteps ::
Prelude.Text ->
AddJobFlowSteps
newAddJobFlowSteps :: Text -> AddJobFlowSteps
newAddJobFlowSteps Text
pJobFlowId_ =
AddJobFlowSteps' :: Text -> [StepConfig] -> AddJobFlowSteps
AddJobFlowSteps'
{ $sel:jobFlowId:AddJobFlowSteps' :: Text
jobFlowId = Text
pJobFlowId_,
$sel:steps:AddJobFlowSteps' :: [StepConfig]
steps = [StepConfig]
forall a. Monoid a => a
Prelude.mempty
}
addJobFlowSteps_jobFlowId :: Lens.Lens' AddJobFlowSteps Prelude.Text
addJobFlowSteps_jobFlowId :: (Text -> f Text) -> AddJobFlowSteps -> f AddJobFlowSteps
addJobFlowSteps_jobFlowId = (AddJobFlowSteps -> Text)
-> (AddJobFlowSteps -> Text -> AddJobFlowSteps)
-> Lens AddJobFlowSteps AddJobFlowSteps Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddJobFlowSteps' {Text
jobFlowId :: Text
$sel:jobFlowId:AddJobFlowSteps' :: AddJobFlowSteps -> Text
jobFlowId} -> Text
jobFlowId) (\s :: AddJobFlowSteps
s@AddJobFlowSteps' {} Text
a -> AddJobFlowSteps
s {$sel:jobFlowId:AddJobFlowSteps' :: Text
jobFlowId = Text
a} :: AddJobFlowSteps)
addJobFlowSteps_steps :: Lens.Lens' AddJobFlowSteps [StepConfig]
addJobFlowSteps_steps :: ([StepConfig] -> f [StepConfig])
-> AddJobFlowSteps -> f AddJobFlowSteps
addJobFlowSteps_steps = (AddJobFlowSteps -> [StepConfig])
-> (AddJobFlowSteps -> [StepConfig] -> AddJobFlowSteps)
-> Lens AddJobFlowSteps AddJobFlowSteps [StepConfig] [StepConfig]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddJobFlowSteps' {[StepConfig]
steps :: [StepConfig]
$sel:steps:AddJobFlowSteps' :: AddJobFlowSteps -> [StepConfig]
steps} -> [StepConfig]
steps) (\s :: AddJobFlowSteps
s@AddJobFlowSteps' {} [StepConfig]
a -> AddJobFlowSteps
s {$sel:steps:AddJobFlowSteps' :: [StepConfig]
steps = [StepConfig]
a} :: AddJobFlowSteps) (([StepConfig] -> f [StepConfig])
-> AddJobFlowSteps -> f AddJobFlowSteps)
-> (([StepConfig] -> f [StepConfig])
-> [StepConfig] -> f [StepConfig])
-> ([StepConfig] -> f [StepConfig])
-> AddJobFlowSteps
-> f AddJobFlowSteps
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([StepConfig] -> f [StepConfig]) -> [StepConfig] -> f [StepConfig]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AddJobFlowSteps where
type
AWSResponse AddJobFlowSteps =
AddJobFlowStepsResponse
request :: AddJobFlowSteps -> Request AddJobFlowSteps
request = Service -> AddJobFlowSteps -> Request AddJobFlowSteps
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddJobFlowSteps
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddJobFlowSteps)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddJobFlowSteps))
-> Logger
-> Service
-> Proxy AddJobFlowSteps
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddJobFlowSteps)))
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 -> AddJobFlowStepsResponse
AddJobFlowStepsResponse'
(Maybe [Text] -> Int -> AddJobFlowStepsResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> AddJobFlowStepsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StepIds" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> AddJobFlowStepsResponse)
-> Either String Int -> Either String AddJobFlowStepsResponse
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 AddJobFlowSteps
instance Prelude.NFData AddJobFlowSteps
instance Core.ToHeaders AddJobFlowSteps where
toHeaders :: AddJobFlowSteps -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddJobFlowSteps -> 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
"ElasticMapReduce.AddJobFlowSteps" ::
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 AddJobFlowSteps where
toJSON :: AddJobFlowSteps -> Value
toJSON AddJobFlowSteps' {[StepConfig]
Text
steps :: [StepConfig]
jobFlowId :: Text
$sel:steps:AddJobFlowSteps' :: AddJobFlowSteps -> [StepConfig]
$sel:jobFlowId:AddJobFlowSteps' :: AddJobFlowSteps -> 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
"JobFlowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobFlowId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Steps" Text -> [StepConfig] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [StepConfig]
steps)
]
)
instance Core.ToPath AddJobFlowSteps where
toPath :: AddJobFlowSteps -> ByteString
toPath = ByteString -> AddJobFlowSteps -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddJobFlowSteps where
toQuery :: AddJobFlowSteps -> QueryString
toQuery = QueryString -> AddJobFlowSteps -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddJobFlowStepsResponse = AddJobFlowStepsResponse'
{
AddJobFlowStepsResponse -> Maybe [Text]
stepIds :: Prelude.Maybe [Prelude.Text],
AddJobFlowStepsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddJobFlowStepsResponse -> AddJobFlowStepsResponse -> Bool
(AddJobFlowStepsResponse -> AddJobFlowStepsResponse -> Bool)
-> (AddJobFlowStepsResponse -> AddJobFlowStepsResponse -> Bool)
-> Eq AddJobFlowStepsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddJobFlowStepsResponse -> AddJobFlowStepsResponse -> Bool
$c/= :: AddJobFlowStepsResponse -> AddJobFlowStepsResponse -> Bool
== :: AddJobFlowStepsResponse -> AddJobFlowStepsResponse -> Bool
$c== :: AddJobFlowStepsResponse -> AddJobFlowStepsResponse -> Bool
Prelude.Eq, ReadPrec [AddJobFlowStepsResponse]
ReadPrec AddJobFlowStepsResponse
Int -> ReadS AddJobFlowStepsResponse
ReadS [AddJobFlowStepsResponse]
(Int -> ReadS AddJobFlowStepsResponse)
-> ReadS [AddJobFlowStepsResponse]
-> ReadPrec AddJobFlowStepsResponse
-> ReadPrec [AddJobFlowStepsResponse]
-> Read AddJobFlowStepsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddJobFlowStepsResponse]
$creadListPrec :: ReadPrec [AddJobFlowStepsResponse]
readPrec :: ReadPrec AddJobFlowStepsResponse
$creadPrec :: ReadPrec AddJobFlowStepsResponse
readList :: ReadS [AddJobFlowStepsResponse]
$creadList :: ReadS [AddJobFlowStepsResponse]
readsPrec :: Int -> ReadS AddJobFlowStepsResponse
$creadsPrec :: Int -> ReadS AddJobFlowStepsResponse
Prelude.Read, Int -> AddJobFlowStepsResponse -> ShowS
[AddJobFlowStepsResponse] -> ShowS
AddJobFlowStepsResponse -> String
(Int -> AddJobFlowStepsResponse -> ShowS)
-> (AddJobFlowStepsResponse -> String)
-> ([AddJobFlowStepsResponse] -> ShowS)
-> Show AddJobFlowStepsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddJobFlowStepsResponse] -> ShowS
$cshowList :: [AddJobFlowStepsResponse] -> ShowS
show :: AddJobFlowStepsResponse -> String
$cshow :: AddJobFlowStepsResponse -> String
showsPrec :: Int -> AddJobFlowStepsResponse -> ShowS
$cshowsPrec :: Int -> AddJobFlowStepsResponse -> ShowS
Prelude.Show, (forall x.
AddJobFlowStepsResponse -> Rep AddJobFlowStepsResponse x)
-> (forall x.
Rep AddJobFlowStepsResponse x -> AddJobFlowStepsResponse)
-> Generic AddJobFlowStepsResponse
forall x. Rep AddJobFlowStepsResponse x -> AddJobFlowStepsResponse
forall x. AddJobFlowStepsResponse -> Rep AddJobFlowStepsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddJobFlowStepsResponse x -> AddJobFlowStepsResponse
$cfrom :: forall x. AddJobFlowStepsResponse -> Rep AddJobFlowStepsResponse x
Prelude.Generic)
newAddJobFlowStepsResponse ::
Prelude.Int ->
AddJobFlowStepsResponse
newAddJobFlowStepsResponse :: Int -> AddJobFlowStepsResponse
newAddJobFlowStepsResponse Int
pHttpStatus_ =
AddJobFlowStepsResponse' :: Maybe [Text] -> Int -> AddJobFlowStepsResponse
AddJobFlowStepsResponse'
{ $sel:stepIds:AddJobFlowStepsResponse' :: Maybe [Text]
stepIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddJobFlowStepsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addJobFlowStepsResponse_stepIds :: Lens.Lens' AddJobFlowStepsResponse (Prelude.Maybe [Prelude.Text])
addJobFlowStepsResponse_stepIds :: (Maybe [Text] -> f (Maybe [Text]))
-> AddJobFlowStepsResponse -> f AddJobFlowStepsResponse
addJobFlowStepsResponse_stepIds = (AddJobFlowStepsResponse -> Maybe [Text])
-> (AddJobFlowStepsResponse
-> Maybe [Text] -> AddJobFlowStepsResponse)
-> Lens
AddJobFlowStepsResponse
AddJobFlowStepsResponse
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddJobFlowStepsResponse' {Maybe [Text]
stepIds :: Maybe [Text]
$sel:stepIds:AddJobFlowStepsResponse' :: AddJobFlowStepsResponse -> Maybe [Text]
stepIds} -> Maybe [Text]
stepIds) (\s :: AddJobFlowStepsResponse
s@AddJobFlowStepsResponse' {} Maybe [Text]
a -> AddJobFlowStepsResponse
s {$sel:stepIds:AddJobFlowStepsResponse' :: Maybe [Text]
stepIds = Maybe [Text]
a} :: AddJobFlowStepsResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> AddJobFlowStepsResponse -> f AddJobFlowStepsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AddJobFlowStepsResponse
-> f AddJobFlowStepsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
addJobFlowStepsResponse_httpStatus :: Lens.Lens' AddJobFlowStepsResponse Prelude.Int
addJobFlowStepsResponse_httpStatus :: (Int -> f Int)
-> AddJobFlowStepsResponse -> f AddJobFlowStepsResponse
addJobFlowStepsResponse_httpStatus = (AddJobFlowStepsResponse -> Int)
-> (AddJobFlowStepsResponse -> Int -> AddJobFlowStepsResponse)
-> Lens AddJobFlowStepsResponse AddJobFlowStepsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddJobFlowStepsResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddJobFlowStepsResponse' :: AddJobFlowStepsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddJobFlowStepsResponse
s@AddJobFlowStepsResponse' {} Int
a -> AddJobFlowStepsResponse
s {$sel:httpStatus:AddJobFlowStepsResponse' :: Int
httpStatus = Int
a} :: AddJobFlowStepsResponse)
instance Prelude.NFData AddJobFlowStepsResponse