{-# 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.ECS.StopTask
(
StopTask (..),
newStopTask,
stopTask_cluster,
stopTask_reason,
stopTask_task,
StopTaskResponse (..),
newStopTaskResponse,
stopTaskResponse_task,
stopTaskResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECS.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 StopTask = StopTask'
{
StopTask -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
StopTask -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
StopTask -> Text
task :: Prelude.Text
}
deriving (StopTask -> StopTask -> Bool
(StopTask -> StopTask -> Bool)
-> (StopTask -> StopTask -> Bool) -> Eq StopTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopTask -> StopTask -> Bool
$c/= :: StopTask -> StopTask -> Bool
== :: StopTask -> StopTask -> Bool
$c== :: StopTask -> StopTask -> Bool
Prelude.Eq, ReadPrec [StopTask]
ReadPrec StopTask
Int -> ReadS StopTask
ReadS [StopTask]
(Int -> ReadS StopTask)
-> ReadS [StopTask]
-> ReadPrec StopTask
-> ReadPrec [StopTask]
-> Read StopTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopTask]
$creadListPrec :: ReadPrec [StopTask]
readPrec :: ReadPrec StopTask
$creadPrec :: ReadPrec StopTask
readList :: ReadS [StopTask]
$creadList :: ReadS [StopTask]
readsPrec :: Int -> ReadS StopTask
$creadsPrec :: Int -> ReadS StopTask
Prelude.Read, Int -> StopTask -> ShowS
[StopTask] -> ShowS
StopTask -> String
(Int -> StopTask -> ShowS)
-> (StopTask -> String) -> ([StopTask] -> ShowS) -> Show StopTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopTask] -> ShowS
$cshowList :: [StopTask] -> ShowS
show :: StopTask -> String
$cshow :: StopTask -> String
showsPrec :: Int -> StopTask -> ShowS
$cshowsPrec :: Int -> StopTask -> ShowS
Prelude.Show, (forall x. StopTask -> Rep StopTask x)
-> (forall x. Rep StopTask x -> StopTask) -> Generic StopTask
forall x. Rep StopTask x -> StopTask
forall x. StopTask -> Rep StopTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopTask x -> StopTask
$cfrom :: forall x. StopTask -> Rep StopTask x
Prelude.Generic)
newStopTask ::
Prelude.Text ->
StopTask
newStopTask :: Text -> StopTask
newStopTask Text
pTask_ =
StopTask' :: Maybe Text -> Maybe Text -> Text -> StopTask
StopTask'
{ $sel:cluster:StopTask' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:reason:StopTask' :: Maybe Text
reason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:task:StopTask' :: Text
task = Text
pTask_
}
stopTask_cluster :: Lens.Lens' StopTask (Prelude.Maybe Prelude.Text)
stopTask_cluster :: (Maybe Text -> f (Maybe Text)) -> StopTask -> f StopTask
stopTask_cluster = (StopTask -> Maybe Text)
-> (StopTask -> Maybe Text -> StopTask)
-> Lens StopTask StopTask (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTask' {Maybe Text
cluster :: Maybe Text
$sel:cluster:StopTask' :: StopTask -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: StopTask
s@StopTask' {} Maybe Text
a -> StopTask
s {$sel:cluster:StopTask' :: Maybe Text
cluster = Maybe Text
a} :: StopTask)
stopTask_reason :: Lens.Lens' StopTask (Prelude.Maybe Prelude.Text)
stopTask_reason :: (Maybe Text -> f (Maybe Text)) -> StopTask -> f StopTask
stopTask_reason = (StopTask -> Maybe Text)
-> (StopTask -> Maybe Text -> StopTask)
-> Lens StopTask StopTask (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTask' {Maybe Text
reason :: Maybe Text
$sel:reason:StopTask' :: StopTask -> Maybe Text
reason} -> Maybe Text
reason) (\s :: StopTask
s@StopTask' {} Maybe Text
a -> StopTask
s {$sel:reason:StopTask' :: Maybe Text
reason = Maybe Text
a} :: StopTask)
stopTask_task :: Lens.Lens' StopTask Prelude.Text
stopTask_task :: (Text -> f Text) -> StopTask -> f StopTask
stopTask_task = (StopTask -> Text)
-> (StopTask -> Text -> StopTask)
-> Lens StopTask StopTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTask' {Text
task :: Text
$sel:task:StopTask' :: StopTask -> Text
task} -> Text
task) (\s :: StopTask
s@StopTask' {} Text
a -> StopTask
s {$sel:task:StopTask' :: Text
task = Text
a} :: StopTask)
instance Core.AWSRequest StopTask where
type AWSResponse StopTask = StopTaskResponse
request :: StopTask -> Request StopTask
request = Service -> StopTask -> Request StopTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StopTask
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopTask)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StopTask))
-> Logger
-> Service
-> Proxy StopTask
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopTask)))
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 Task -> Int -> StopTaskResponse
StopTaskResponse'
(Maybe Task -> Int -> StopTaskResponse)
-> Either String (Maybe Task)
-> Either String (Int -> StopTaskResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Task)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"task")
Either String (Int -> StopTaskResponse)
-> Either String Int -> Either String StopTaskResponse
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 StopTask
instance Prelude.NFData StopTask
instance Core.ToHeaders StopTask where
toHeaders :: StopTask -> ResponseHeaders
toHeaders =
ResponseHeaders -> StopTask -> 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
"AmazonEC2ContainerServiceV20141113.StopTask" ::
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 StopTask where
toJSON :: StopTask -> Value
toJSON StopTask' {Maybe Text
Text
task :: Text
reason :: Maybe Text
cluster :: Maybe Text
$sel:task:StopTask' :: StopTask -> Text
$sel:reason:StopTask' :: StopTask -> Maybe Text
$sel:cluster:StopTask' :: StopTask -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"cluster" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cluster,
(Text
"reason" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
reason,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"task" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
task)
]
)
instance Core.ToPath StopTask where
toPath :: StopTask -> ByteString
toPath = ByteString -> StopTask -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StopTask where
toQuery :: StopTask -> QueryString
toQuery = QueryString -> StopTask -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopTaskResponse = StopTaskResponse'
{
StopTaskResponse -> Maybe Task
task :: Prelude.Maybe Task,
StopTaskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StopTaskResponse -> StopTaskResponse -> Bool
(StopTaskResponse -> StopTaskResponse -> Bool)
-> (StopTaskResponse -> StopTaskResponse -> Bool)
-> Eq StopTaskResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopTaskResponse -> StopTaskResponse -> Bool
$c/= :: StopTaskResponse -> StopTaskResponse -> Bool
== :: StopTaskResponse -> StopTaskResponse -> Bool
$c== :: StopTaskResponse -> StopTaskResponse -> Bool
Prelude.Eq, ReadPrec [StopTaskResponse]
ReadPrec StopTaskResponse
Int -> ReadS StopTaskResponse
ReadS [StopTaskResponse]
(Int -> ReadS StopTaskResponse)
-> ReadS [StopTaskResponse]
-> ReadPrec StopTaskResponse
-> ReadPrec [StopTaskResponse]
-> Read StopTaskResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopTaskResponse]
$creadListPrec :: ReadPrec [StopTaskResponse]
readPrec :: ReadPrec StopTaskResponse
$creadPrec :: ReadPrec StopTaskResponse
readList :: ReadS [StopTaskResponse]
$creadList :: ReadS [StopTaskResponse]
readsPrec :: Int -> ReadS StopTaskResponse
$creadsPrec :: Int -> ReadS StopTaskResponse
Prelude.Read, Int -> StopTaskResponse -> ShowS
[StopTaskResponse] -> ShowS
StopTaskResponse -> String
(Int -> StopTaskResponse -> ShowS)
-> (StopTaskResponse -> String)
-> ([StopTaskResponse] -> ShowS)
-> Show StopTaskResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopTaskResponse] -> ShowS
$cshowList :: [StopTaskResponse] -> ShowS
show :: StopTaskResponse -> String
$cshow :: StopTaskResponse -> String
showsPrec :: Int -> StopTaskResponse -> ShowS
$cshowsPrec :: Int -> StopTaskResponse -> ShowS
Prelude.Show, (forall x. StopTaskResponse -> Rep StopTaskResponse x)
-> (forall x. Rep StopTaskResponse x -> StopTaskResponse)
-> Generic StopTaskResponse
forall x. Rep StopTaskResponse x -> StopTaskResponse
forall x. StopTaskResponse -> Rep StopTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopTaskResponse x -> StopTaskResponse
$cfrom :: forall x. StopTaskResponse -> Rep StopTaskResponse x
Prelude.Generic)
newStopTaskResponse ::
Prelude.Int ->
StopTaskResponse
newStopTaskResponse :: Int -> StopTaskResponse
newStopTaskResponse Int
pHttpStatus_ =
StopTaskResponse' :: Maybe Task -> Int -> StopTaskResponse
StopTaskResponse'
{ $sel:task:StopTaskResponse' :: Maybe Task
task = Maybe Task
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StopTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
stopTaskResponse_task :: Lens.Lens' StopTaskResponse (Prelude.Maybe Task)
stopTaskResponse_task :: (Maybe Task -> f (Maybe Task))
-> StopTaskResponse -> f StopTaskResponse
stopTaskResponse_task = (StopTaskResponse -> Maybe Task)
-> (StopTaskResponse -> Maybe Task -> StopTaskResponse)
-> Lens StopTaskResponse StopTaskResponse (Maybe Task) (Maybe Task)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTaskResponse' {Maybe Task
task :: Maybe Task
$sel:task:StopTaskResponse' :: StopTaskResponse -> Maybe Task
task} -> Maybe Task
task) (\s :: StopTaskResponse
s@StopTaskResponse' {} Maybe Task
a -> StopTaskResponse
s {$sel:task:StopTaskResponse' :: Maybe Task
task = Maybe Task
a} :: StopTaskResponse)
stopTaskResponse_httpStatus :: Lens.Lens' StopTaskResponse Prelude.Int
stopTaskResponse_httpStatus :: (Int -> f Int) -> StopTaskResponse -> f StopTaskResponse
stopTaskResponse_httpStatus = (StopTaskResponse -> Int)
-> (StopTaskResponse -> Int -> StopTaskResponse)
-> Lens StopTaskResponse StopTaskResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopTaskResponse' :: StopTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopTaskResponse
s@StopTaskResponse' {} Int
a -> StopTaskResponse
s {$sel:httpStatus:StopTaskResponse' :: Int
httpStatus = Int
a} :: StopTaskResponse)
instance Prelude.NFData StopTaskResponse