{-# 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.CancelSteps
(
CancelSteps (..),
newCancelSteps,
cancelSteps_stepCancellationOption,
cancelSteps_clusterId,
cancelSteps_stepIds,
CancelStepsResponse (..),
newCancelStepsResponse,
cancelStepsResponse_cancelStepsInfoList,
cancelStepsResponse_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 CancelSteps = CancelSteps'
{
CancelSteps -> Maybe StepCancellationOption
stepCancellationOption :: Prelude.Maybe StepCancellationOption,
CancelSteps -> Text
clusterId :: Prelude.Text,
CancelSteps -> [Text]
stepIds :: [Prelude.Text]
}
deriving (CancelSteps -> CancelSteps -> Bool
(CancelSteps -> CancelSteps -> Bool)
-> (CancelSteps -> CancelSteps -> Bool) -> Eq CancelSteps
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelSteps -> CancelSteps -> Bool
$c/= :: CancelSteps -> CancelSteps -> Bool
== :: CancelSteps -> CancelSteps -> Bool
$c== :: CancelSteps -> CancelSteps -> Bool
Prelude.Eq, ReadPrec [CancelSteps]
ReadPrec CancelSteps
Int -> ReadS CancelSteps
ReadS [CancelSteps]
(Int -> ReadS CancelSteps)
-> ReadS [CancelSteps]
-> ReadPrec CancelSteps
-> ReadPrec [CancelSteps]
-> Read CancelSteps
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelSteps]
$creadListPrec :: ReadPrec [CancelSteps]
readPrec :: ReadPrec CancelSteps
$creadPrec :: ReadPrec CancelSteps
readList :: ReadS [CancelSteps]
$creadList :: ReadS [CancelSteps]
readsPrec :: Int -> ReadS CancelSteps
$creadsPrec :: Int -> ReadS CancelSteps
Prelude.Read, Int -> CancelSteps -> ShowS
[CancelSteps] -> ShowS
CancelSteps -> String
(Int -> CancelSteps -> ShowS)
-> (CancelSteps -> String)
-> ([CancelSteps] -> ShowS)
-> Show CancelSteps
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelSteps] -> ShowS
$cshowList :: [CancelSteps] -> ShowS
show :: CancelSteps -> String
$cshow :: CancelSteps -> String
showsPrec :: Int -> CancelSteps -> ShowS
$cshowsPrec :: Int -> CancelSteps -> ShowS
Prelude.Show, (forall x. CancelSteps -> Rep CancelSteps x)
-> (forall x. Rep CancelSteps x -> CancelSteps)
-> Generic CancelSteps
forall x. Rep CancelSteps x -> CancelSteps
forall x. CancelSteps -> Rep CancelSteps x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelSteps x -> CancelSteps
$cfrom :: forall x. CancelSteps -> Rep CancelSteps x
Prelude.Generic)
newCancelSteps ::
Prelude.Text ->
CancelSteps
newCancelSteps :: Text -> CancelSteps
newCancelSteps Text
pClusterId_ =
CancelSteps' :: Maybe StepCancellationOption -> Text -> [Text] -> CancelSteps
CancelSteps'
{ $sel:stepCancellationOption:CancelSteps' :: Maybe StepCancellationOption
stepCancellationOption =
Maybe StepCancellationOption
forall a. Maybe a
Prelude.Nothing,
$sel:clusterId:CancelSteps' :: Text
clusterId = Text
pClusterId_,
$sel:stepIds:CancelSteps' :: [Text]
stepIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
cancelSteps_stepCancellationOption :: Lens.Lens' CancelSteps (Prelude.Maybe StepCancellationOption)
cancelSteps_stepCancellationOption :: (Maybe StepCancellationOption -> f (Maybe StepCancellationOption))
-> CancelSteps -> f CancelSteps
cancelSteps_stepCancellationOption = (CancelSteps -> Maybe StepCancellationOption)
-> (CancelSteps -> Maybe StepCancellationOption -> CancelSteps)
-> Lens
CancelSteps
CancelSteps
(Maybe StepCancellationOption)
(Maybe StepCancellationOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelSteps' {Maybe StepCancellationOption
stepCancellationOption :: Maybe StepCancellationOption
$sel:stepCancellationOption:CancelSteps' :: CancelSteps -> Maybe StepCancellationOption
stepCancellationOption} -> Maybe StepCancellationOption
stepCancellationOption) (\s :: CancelSteps
s@CancelSteps' {} Maybe StepCancellationOption
a -> CancelSteps
s {$sel:stepCancellationOption:CancelSteps' :: Maybe StepCancellationOption
stepCancellationOption = Maybe StepCancellationOption
a} :: CancelSteps)
cancelSteps_clusterId :: Lens.Lens' CancelSteps Prelude.Text
cancelSteps_clusterId :: (Text -> f Text) -> CancelSteps -> f CancelSteps
cancelSteps_clusterId = (CancelSteps -> Text)
-> (CancelSteps -> Text -> CancelSteps)
-> Lens CancelSteps CancelSteps Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelSteps' {Text
clusterId :: Text
$sel:clusterId:CancelSteps' :: CancelSteps -> Text
clusterId} -> Text
clusterId) (\s :: CancelSteps
s@CancelSteps' {} Text
a -> CancelSteps
s {$sel:clusterId:CancelSteps' :: Text
clusterId = Text
a} :: CancelSteps)
cancelSteps_stepIds :: Lens.Lens' CancelSteps [Prelude.Text]
cancelSteps_stepIds :: ([Text] -> f [Text]) -> CancelSteps -> f CancelSteps
cancelSteps_stepIds = (CancelSteps -> [Text])
-> (CancelSteps -> [Text] -> CancelSteps)
-> Lens CancelSteps CancelSteps [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelSteps' {[Text]
stepIds :: [Text]
$sel:stepIds:CancelSteps' :: CancelSteps -> [Text]
stepIds} -> [Text]
stepIds) (\s :: CancelSteps
s@CancelSteps' {} [Text]
a -> CancelSteps
s {$sel:stepIds:CancelSteps' :: [Text]
stepIds = [Text]
a} :: CancelSteps) (([Text] -> f [Text]) -> CancelSteps -> f CancelSteps)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CancelSteps
-> f CancelSteps
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CancelSteps where
type AWSResponse CancelSteps = CancelStepsResponse
request :: CancelSteps -> Request CancelSteps
request = Service -> CancelSteps -> Request CancelSteps
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CancelSteps
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelSteps)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CancelSteps))
-> Logger
-> Service
-> Proxy CancelSteps
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelSteps)))
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 [CancelStepsInfo] -> Int -> CancelStepsResponse
CancelStepsResponse'
(Maybe [CancelStepsInfo] -> Int -> CancelStepsResponse)
-> Either String (Maybe [CancelStepsInfo])
-> Either String (Int -> CancelStepsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [CancelStepsInfo]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CancelStepsInfoList"
Either String (Maybe (Maybe [CancelStepsInfo]))
-> Maybe [CancelStepsInfo]
-> Either String (Maybe [CancelStepsInfo])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CancelStepsInfo]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> CancelStepsResponse)
-> Either String Int -> Either String CancelStepsResponse
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 CancelSteps
instance Prelude.NFData CancelSteps
instance Core.ToHeaders CancelSteps where
toHeaders :: CancelSteps -> ResponseHeaders
toHeaders =
ResponseHeaders -> CancelSteps -> 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.CancelSteps" ::
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 CancelSteps where
toJSON :: CancelSteps -> Value
toJSON CancelSteps' {[Text]
Maybe StepCancellationOption
Text
stepIds :: [Text]
clusterId :: Text
stepCancellationOption :: Maybe StepCancellationOption
$sel:stepIds:CancelSteps' :: CancelSteps -> [Text]
$sel:clusterId:CancelSteps' :: CancelSteps -> Text
$sel:stepCancellationOption:CancelSteps' :: CancelSteps -> Maybe StepCancellationOption
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"StepCancellationOption" Text -> StepCancellationOption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(StepCancellationOption -> Pair)
-> Maybe StepCancellationOption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StepCancellationOption
stepCancellationOption,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClusterId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clusterId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StepIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
stepIds)
]
)
instance Core.ToPath CancelSteps where
toPath :: CancelSteps -> ByteString
toPath = ByteString -> CancelSteps -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CancelSteps where
toQuery :: CancelSteps -> QueryString
toQuery = QueryString -> CancelSteps -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CancelStepsResponse = CancelStepsResponse'
{
CancelStepsResponse -> Maybe [CancelStepsInfo]
cancelStepsInfoList :: Prelude.Maybe [CancelStepsInfo],
CancelStepsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CancelStepsResponse -> CancelStepsResponse -> Bool
(CancelStepsResponse -> CancelStepsResponse -> Bool)
-> (CancelStepsResponse -> CancelStepsResponse -> Bool)
-> Eq CancelStepsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelStepsResponse -> CancelStepsResponse -> Bool
$c/= :: CancelStepsResponse -> CancelStepsResponse -> Bool
== :: CancelStepsResponse -> CancelStepsResponse -> Bool
$c== :: CancelStepsResponse -> CancelStepsResponse -> Bool
Prelude.Eq, ReadPrec [CancelStepsResponse]
ReadPrec CancelStepsResponse
Int -> ReadS CancelStepsResponse
ReadS [CancelStepsResponse]
(Int -> ReadS CancelStepsResponse)
-> ReadS [CancelStepsResponse]
-> ReadPrec CancelStepsResponse
-> ReadPrec [CancelStepsResponse]
-> Read CancelStepsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelStepsResponse]
$creadListPrec :: ReadPrec [CancelStepsResponse]
readPrec :: ReadPrec CancelStepsResponse
$creadPrec :: ReadPrec CancelStepsResponse
readList :: ReadS [CancelStepsResponse]
$creadList :: ReadS [CancelStepsResponse]
readsPrec :: Int -> ReadS CancelStepsResponse
$creadsPrec :: Int -> ReadS CancelStepsResponse
Prelude.Read, Int -> CancelStepsResponse -> ShowS
[CancelStepsResponse] -> ShowS
CancelStepsResponse -> String
(Int -> CancelStepsResponse -> ShowS)
-> (CancelStepsResponse -> String)
-> ([CancelStepsResponse] -> ShowS)
-> Show CancelStepsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelStepsResponse] -> ShowS
$cshowList :: [CancelStepsResponse] -> ShowS
show :: CancelStepsResponse -> String
$cshow :: CancelStepsResponse -> String
showsPrec :: Int -> CancelStepsResponse -> ShowS
$cshowsPrec :: Int -> CancelStepsResponse -> ShowS
Prelude.Show, (forall x. CancelStepsResponse -> Rep CancelStepsResponse x)
-> (forall x. Rep CancelStepsResponse x -> CancelStepsResponse)
-> Generic CancelStepsResponse
forall x. Rep CancelStepsResponse x -> CancelStepsResponse
forall x. CancelStepsResponse -> Rep CancelStepsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelStepsResponse x -> CancelStepsResponse
$cfrom :: forall x. CancelStepsResponse -> Rep CancelStepsResponse x
Prelude.Generic)
newCancelStepsResponse ::
Prelude.Int ->
CancelStepsResponse
newCancelStepsResponse :: Int -> CancelStepsResponse
newCancelStepsResponse Int
pHttpStatus_ =
CancelStepsResponse' :: Maybe [CancelStepsInfo] -> Int -> CancelStepsResponse
CancelStepsResponse'
{ $sel:cancelStepsInfoList:CancelStepsResponse' :: Maybe [CancelStepsInfo]
cancelStepsInfoList =
Maybe [CancelStepsInfo]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CancelStepsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
cancelStepsResponse_cancelStepsInfoList :: Lens.Lens' CancelStepsResponse (Prelude.Maybe [CancelStepsInfo])
cancelStepsResponse_cancelStepsInfoList :: (Maybe [CancelStepsInfo] -> f (Maybe [CancelStepsInfo]))
-> CancelStepsResponse -> f CancelStepsResponse
cancelStepsResponse_cancelStepsInfoList = (CancelStepsResponse -> Maybe [CancelStepsInfo])
-> (CancelStepsResponse
-> Maybe [CancelStepsInfo] -> CancelStepsResponse)
-> Lens
CancelStepsResponse
CancelStepsResponse
(Maybe [CancelStepsInfo])
(Maybe [CancelStepsInfo])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelStepsResponse' {Maybe [CancelStepsInfo]
cancelStepsInfoList :: Maybe [CancelStepsInfo]
$sel:cancelStepsInfoList:CancelStepsResponse' :: CancelStepsResponse -> Maybe [CancelStepsInfo]
cancelStepsInfoList} -> Maybe [CancelStepsInfo]
cancelStepsInfoList) (\s :: CancelStepsResponse
s@CancelStepsResponse' {} Maybe [CancelStepsInfo]
a -> CancelStepsResponse
s {$sel:cancelStepsInfoList:CancelStepsResponse' :: Maybe [CancelStepsInfo]
cancelStepsInfoList = Maybe [CancelStepsInfo]
a} :: CancelStepsResponse) ((Maybe [CancelStepsInfo] -> f (Maybe [CancelStepsInfo]))
-> CancelStepsResponse -> f CancelStepsResponse)
-> ((Maybe [CancelStepsInfo] -> f (Maybe [CancelStepsInfo]))
-> Maybe [CancelStepsInfo] -> f (Maybe [CancelStepsInfo]))
-> (Maybe [CancelStepsInfo] -> f (Maybe [CancelStepsInfo]))
-> CancelStepsResponse
-> f CancelStepsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[CancelStepsInfo]
[CancelStepsInfo]
[CancelStepsInfo]
[CancelStepsInfo]
-> Iso
(Maybe [CancelStepsInfo])
(Maybe [CancelStepsInfo])
(Maybe [CancelStepsInfo])
(Maybe [CancelStepsInfo])
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
[CancelStepsInfo]
[CancelStepsInfo]
[CancelStepsInfo]
[CancelStepsInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
cancelStepsResponse_httpStatus :: Lens.Lens' CancelStepsResponse Prelude.Int
cancelStepsResponse_httpStatus :: (Int -> f Int) -> CancelStepsResponse -> f CancelStepsResponse
cancelStepsResponse_httpStatus = (CancelStepsResponse -> Int)
-> (CancelStepsResponse -> Int -> CancelStepsResponse)
-> Lens CancelStepsResponse CancelStepsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelStepsResponse' {Int
httpStatus :: Int
$sel:httpStatus:CancelStepsResponse' :: CancelStepsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CancelStepsResponse
s@CancelStepsResponse' {} Int
a -> CancelStepsResponse
s {$sel:httpStatus:CancelStepsResponse' :: Int
httpStatus = Int
a} :: CancelStepsResponse)
instance Prelude.NFData CancelStepsResponse