{-# 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.EMRContainers.CancelJobRun
(
CancelJobRun (..),
newCancelJobRun,
cancelJobRun_id,
cancelJobRun_virtualClusterId,
CancelJobRunResponse (..),
newCancelJobRunResponse,
cancelJobRunResponse_id,
cancelJobRunResponse_virtualClusterId,
cancelJobRunResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EMRContainers.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 CancelJobRun = CancelJobRun'
{
CancelJobRun -> Text
id :: Prelude.Text,
CancelJobRun -> Text
virtualClusterId :: Prelude.Text
}
deriving (CancelJobRun -> CancelJobRun -> Bool
(CancelJobRun -> CancelJobRun -> Bool)
-> (CancelJobRun -> CancelJobRun -> Bool) -> Eq CancelJobRun
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelJobRun -> CancelJobRun -> Bool
$c/= :: CancelJobRun -> CancelJobRun -> Bool
== :: CancelJobRun -> CancelJobRun -> Bool
$c== :: CancelJobRun -> CancelJobRun -> Bool
Prelude.Eq, ReadPrec [CancelJobRun]
ReadPrec CancelJobRun
Int -> ReadS CancelJobRun
ReadS [CancelJobRun]
(Int -> ReadS CancelJobRun)
-> ReadS [CancelJobRun]
-> ReadPrec CancelJobRun
-> ReadPrec [CancelJobRun]
-> Read CancelJobRun
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelJobRun]
$creadListPrec :: ReadPrec [CancelJobRun]
readPrec :: ReadPrec CancelJobRun
$creadPrec :: ReadPrec CancelJobRun
readList :: ReadS [CancelJobRun]
$creadList :: ReadS [CancelJobRun]
readsPrec :: Int -> ReadS CancelJobRun
$creadsPrec :: Int -> ReadS CancelJobRun
Prelude.Read, Int -> CancelJobRun -> ShowS
[CancelJobRun] -> ShowS
CancelJobRun -> String
(Int -> CancelJobRun -> ShowS)
-> (CancelJobRun -> String)
-> ([CancelJobRun] -> ShowS)
-> Show CancelJobRun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelJobRun] -> ShowS
$cshowList :: [CancelJobRun] -> ShowS
show :: CancelJobRun -> String
$cshow :: CancelJobRun -> String
showsPrec :: Int -> CancelJobRun -> ShowS
$cshowsPrec :: Int -> CancelJobRun -> ShowS
Prelude.Show, (forall x. CancelJobRun -> Rep CancelJobRun x)
-> (forall x. Rep CancelJobRun x -> CancelJobRun)
-> Generic CancelJobRun
forall x. Rep CancelJobRun x -> CancelJobRun
forall x. CancelJobRun -> Rep CancelJobRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelJobRun x -> CancelJobRun
$cfrom :: forall x. CancelJobRun -> Rep CancelJobRun x
Prelude.Generic)
newCancelJobRun ::
Prelude.Text ->
Prelude.Text ->
CancelJobRun
newCancelJobRun :: Text -> Text -> CancelJobRun
newCancelJobRun Text
pId_ Text
pVirtualClusterId_ =
CancelJobRun' :: Text -> Text -> CancelJobRun
CancelJobRun'
{ $sel:id:CancelJobRun' :: Text
id = Text
pId_,
$sel:virtualClusterId:CancelJobRun' :: Text
virtualClusterId = Text
pVirtualClusterId_
}
cancelJobRun_id :: Lens.Lens' CancelJobRun Prelude.Text
cancelJobRun_id :: (Text -> f Text) -> CancelJobRun -> f CancelJobRun
cancelJobRun_id = (CancelJobRun -> Text)
-> (CancelJobRun -> Text -> CancelJobRun)
-> Lens CancelJobRun CancelJobRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobRun' {Text
id :: Text
$sel:id:CancelJobRun' :: CancelJobRun -> Text
id} -> Text
id) (\s :: CancelJobRun
s@CancelJobRun' {} Text
a -> CancelJobRun
s {$sel:id:CancelJobRun' :: Text
id = Text
a} :: CancelJobRun)
cancelJobRun_virtualClusterId :: Lens.Lens' CancelJobRun Prelude.Text
cancelJobRun_virtualClusterId :: (Text -> f Text) -> CancelJobRun -> f CancelJobRun
cancelJobRun_virtualClusterId = (CancelJobRun -> Text)
-> (CancelJobRun -> Text -> CancelJobRun)
-> Lens CancelJobRun CancelJobRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobRun' {Text
virtualClusterId :: Text
$sel:virtualClusterId:CancelJobRun' :: CancelJobRun -> Text
virtualClusterId} -> Text
virtualClusterId) (\s :: CancelJobRun
s@CancelJobRun' {} Text
a -> CancelJobRun
s {$sel:virtualClusterId:CancelJobRun' :: Text
virtualClusterId = Text
a} :: CancelJobRun)
instance Core.AWSRequest CancelJobRun where
type AWSResponse CancelJobRun = CancelJobRunResponse
request :: CancelJobRun -> Request CancelJobRun
request = Service -> CancelJobRun -> Request CancelJobRun
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy CancelJobRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelJobRun)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CancelJobRun))
-> Logger
-> Service
-> Proxy CancelJobRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelJobRun)))
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 -> CancelJobRunResponse
CancelJobRunResponse'
(Maybe Text -> Maybe Text -> Int -> CancelJobRunResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CancelJobRunResponse)
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
"id")
Either String (Maybe Text -> Int -> CancelJobRunResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CancelJobRunResponse)
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
"virtualClusterId")
Either String (Int -> CancelJobRunResponse)
-> Either String Int -> Either String CancelJobRunResponse
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 CancelJobRun
instance Prelude.NFData CancelJobRun
instance Core.ToHeaders CancelJobRun where
toHeaders :: CancelJobRun -> ResponseHeaders
toHeaders =
ResponseHeaders -> CancelJobRun -> 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.ToPath CancelJobRun where
toPath :: CancelJobRun -> ByteString
toPath CancelJobRun' {Text
virtualClusterId :: Text
id :: Text
$sel:virtualClusterId:CancelJobRun' :: CancelJobRun -> Text
$sel:id:CancelJobRun' :: CancelJobRun -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/virtualclusters/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
virtualClusterId,
ByteString
"/jobruns/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id
]
instance Core.ToQuery CancelJobRun where
toQuery :: CancelJobRun -> QueryString
toQuery = QueryString -> CancelJobRun -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CancelJobRunResponse = CancelJobRunResponse'
{
CancelJobRunResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
CancelJobRunResponse -> Maybe Text
virtualClusterId :: Prelude.Maybe Prelude.Text,
CancelJobRunResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CancelJobRunResponse -> CancelJobRunResponse -> Bool
(CancelJobRunResponse -> CancelJobRunResponse -> Bool)
-> (CancelJobRunResponse -> CancelJobRunResponse -> Bool)
-> Eq CancelJobRunResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelJobRunResponse -> CancelJobRunResponse -> Bool
$c/= :: CancelJobRunResponse -> CancelJobRunResponse -> Bool
== :: CancelJobRunResponse -> CancelJobRunResponse -> Bool
$c== :: CancelJobRunResponse -> CancelJobRunResponse -> Bool
Prelude.Eq, ReadPrec [CancelJobRunResponse]
ReadPrec CancelJobRunResponse
Int -> ReadS CancelJobRunResponse
ReadS [CancelJobRunResponse]
(Int -> ReadS CancelJobRunResponse)
-> ReadS [CancelJobRunResponse]
-> ReadPrec CancelJobRunResponse
-> ReadPrec [CancelJobRunResponse]
-> Read CancelJobRunResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelJobRunResponse]
$creadListPrec :: ReadPrec [CancelJobRunResponse]
readPrec :: ReadPrec CancelJobRunResponse
$creadPrec :: ReadPrec CancelJobRunResponse
readList :: ReadS [CancelJobRunResponse]
$creadList :: ReadS [CancelJobRunResponse]
readsPrec :: Int -> ReadS CancelJobRunResponse
$creadsPrec :: Int -> ReadS CancelJobRunResponse
Prelude.Read, Int -> CancelJobRunResponse -> ShowS
[CancelJobRunResponse] -> ShowS
CancelJobRunResponse -> String
(Int -> CancelJobRunResponse -> ShowS)
-> (CancelJobRunResponse -> String)
-> ([CancelJobRunResponse] -> ShowS)
-> Show CancelJobRunResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelJobRunResponse] -> ShowS
$cshowList :: [CancelJobRunResponse] -> ShowS
show :: CancelJobRunResponse -> String
$cshow :: CancelJobRunResponse -> String
showsPrec :: Int -> CancelJobRunResponse -> ShowS
$cshowsPrec :: Int -> CancelJobRunResponse -> ShowS
Prelude.Show, (forall x. CancelJobRunResponse -> Rep CancelJobRunResponse x)
-> (forall x. Rep CancelJobRunResponse x -> CancelJobRunResponse)
-> Generic CancelJobRunResponse
forall x. Rep CancelJobRunResponse x -> CancelJobRunResponse
forall x. CancelJobRunResponse -> Rep CancelJobRunResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelJobRunResponse x -> CancelJobRunResponse
$cfrom :: forall x. CancelJobRunResponse -> Rep CancelJobRunResponse x
Prelude.Generic)
newCancelJobRunResponse ::
Prelude.Int ->
CancelJobRunResponse
newCancelJobRunResponse :: Int -> CancelJobRunResponse
newCancelJobRunResponse Int
pHttpStatus_ =
CancelJobRunResponse' :: Maybe Text -> Maybe Text -> Int -> CancelJobRunResponse
CancelJobRunResponse'
{ $sel:id:CancelJobRunResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:virtualClusterId:CancelJobRunResponse' :: Maybe Text
virtualClusterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CancelJobRunResponse' :: Int
httpStatus = Int
pHttpStatus_
}
cancelJobRunResponse_id :: Lens.Lens' CancelJobRunResponse (Prelude.Maybe Prelude.Text)
cancelJobRunResponse_id :: (Maybe Text -> f (Maybe Text))
-> CancelJobRunResponse -> f CancelJobRunResponse
cancelJobRunResponse_id = (CancelJobRunResponse -> Maybe Text)
-> (CancelJobRunResponse -> Maybe Text -> CancelJobRunResponse)
-> Lens
CancelJobRunResponse CancelJobRunResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobRunResponse' {Maybe Text
id :: Maybe Text
$sel:id:CancelJobRunResponse' :: CancelJobRunResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: CancelJobRunResponse
s@CancelJobRunResponse' {} Maybe Text
a -> CancelJobRunResponse
s {$sel:id:CancelJobRunResponse' :: Maybe Text
id = Maybe Text
a} :: CancelJobRunResponse)
cancelJobRunResponse_virtualClusterId :: Lens.Lens' CancelJobRunResponse (Prelude.Maybe Prelude.Text)
cancelJobRunResponse_virtualClusterId :: (Maybe Text -> f (Maybe Text))
-> CancelJobRunResponse -> f CancelJobRunResponse
cancelJobRunResponse_virtualClusterId = (CancelJobRunResponse -> Maybe Text)
-> (CancelJobRunResponse -> Maybe Text -> CancelJobRunResponse)
-> Lens
CancelJobRunResponse CancelJobRunResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobRunResponse' {Maybe Text
virtualClusterId :: Maybe Text
$sel:virtualClusterId:CancelJobRunResponse' :: CancelJobRunResponse -> Maybe Text
virtualClusterId} -> Maybe Text
virtualClusterId) (\s :: CancelJobRunResponse
s@CancelJobRunResponse' {} Maybe Text
a -> CancelJobRunResponse
s {$sel:virtualClusterId:CancelJobRunResponse' :: Maybe Text
virtualClusterId = Maybe Text
a} :: CancelJobRunResponse)
cancelJobRunResponse_httpStatus :: Lens.Lens' CancelJobRunResponse Prelude.Int
cancelJobRunResponse_httpStatus :: (Int -> f Int) -> CancelJobRunResponse -> f CancelJobRunResponse
cancelJobRunResponse_httpStatus = (CancelJobRunResponse -> Int)
-> (CancelJobRunResponse -> Int -> CancelJobRunResponse)
-> Lens CancelJobRunResponse CancelJobRunResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJobRunResponse' {Int
httpStatus :: Int
$sel:httpStatus:CancelJobRunResponse' :: CancelJobRunResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CancelJobRunResponse
s@CancelJobRunResponse' {} Int
a -> CancelJobRunResponse
s {$sel:httpStatus:CancelJobRunResponse' :: Int
httpStatus = Int
a} :: CancelJobRunResponse)
instance Prelude.NFData CancelJobRunResponse