{-# 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.GetTaskProtection
(
GetTaskProtection (..),
newGetTaskProtection,
getTaskProtection_tasks,
getTaskProtection_cluster,
GetTaskProtectionResponse (..),
newGetTaskProtectionResponse,
getTaskProtectionResponse_failures,
getTaskProtectionResponse_protectedTasks,
getTaskProtectionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetTaskProtection = GetTaskProtection'
{
GetTaskProtection -> Maybe [Text]
tasks :: Prelude.Maybe [Prelude.Text],
GetTaskProtection -> Text
cluster :: Prelude.Text
}
deriving (GetTaskProtection -> GetTaskProtection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTaskProtection -> GetTaskProtection -> Bool
$c/= :: GetTaskProtection -> GetTaskProtection -> Bool
== :: GetTaskProtection -> GetTaskProtection -> Bool
$c== :: GetTaskProtection -> GetTaskProtection -> Bool
Prelude.Eq, ReadPrec [GetTaskProtection]
ReadPrec GetTaskProtection
Int -> ReadS GetTaskProtection
ReadS [GetTaskProtection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTaskProtection]
$creadListPrec :: ReadPrec [GetTaskProtection]
readPrec :: ReadPrec GetTaskProtection
$creadPrec :: ReadPrec GetTaskProtection
readList :: ReadS [GetTaskProtection]
$creadList :: ReadS [GetTaskProtection]
readsPrec :: Int -> ReadS GetTaskProtection
$creadsPrec :: Int -> ReadS GetTaskProtection
Prelude.Read, Int -> GetTaskProtection -> ShowS
[GetTaskProtection] -> ShowS
GetTaskProtection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTaskProtection] -> ShowS
$cshowList :: [GetTaskProtection] -> ShowS
show :: GetTaskProtection -> String
$cshow :: GetTaskProtection -> String
showsPrec :: Int -> GetTaskProtection -> ShowS
$cshowsPrec :: Int -> GetTaskProtection -> ShowS
Prelude.Show, forall x. Rep GetTaskProtection x -> GetTaskProtection
forall x. GetTaskProtection -> Rep GetTaskProtection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTaskProtection x -> GetTaskProtection
$cfrom :: forall x. GetTaskProtection -> Rep GetTaskProtection x
Prelude.Generic)
newGetTaskProtection ::
Prelude.Text ->
GetTaskProtection
newGetTaskProtection :: Text -> GetTaskProtection
newGetTaskProtection Text
pCluster_ =
GetTaskProtection'
{ $sel:tasks:GetTaskProtection' :: Maybe [Text]
tasks = forall a. Maybe a
Prelude.Nothing,
$sel:cluster:GetTaskProtection' :: Text
cluster = Text
pCluster_
}
getTaskProtection_tasks :: Lens.Lens' GetTaskProtection (Prelude.Maybe [Prelude.Text])
getTaskProtection_tasks :: Lens' GetTaskProtection (Maybe [Text])
getTaskProtection_tasks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTaskProtection' {Maybe [Text]
tasks :: Maybe [Text]
$sel:tasks:GetTaskProtection' :: GetTaskProtection -> Maybe [Text]
tasks} -> Maybe [Text]
tasks) (\s :: GetTaskProtection
s@GetTaskProtection' {} Maybe [Text]
a -> GetTaskProtection
s {$sel:tasks:GetTaskProtection' :: Maybe [Text]
tasks = Maybe [Text]
a} :: GetTaskProtection) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getTaskProtection_cluster :: Lens.Lens' GetTaskProtection Prelude.Text
getTaskProtection_cluster :: Lens' GetTaskProtection Text
getTaskProtection_cluster = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTaskProtection' {Text
cluster :: Text
$sel:cluster:GetTaskProtection' :: GetTaskProtection -> Text
cluster} -> Text
cluster) (\s :: GetTaskProtection
s@GetTaskProtection' {} Text
a -> GetTaskProtection
s {$sel:cluster:GetTaskProtection' :: Text
cluster = Text
a} :: GetTaskProtection)
instance Core.AWSRequest GetTaskProtection where
type
AWSResponse GetTaskProtection =
GetTaskProtectionResponse
request :: (Service -> Service)
-> GetTaskProtection -> Request GetTaskProtection
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetTaskProtection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetTaskProtection)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Failure]
-> Maybe [ProtectedTask] -> Int -> GetTaskProtectionResponse
GetTaskProtectionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"failures" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"protectedTasks" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetTaskProtection where
hashWithSalt :: Int -> GetTaskProtection -> Int
hashWithSalt Int
_salt GetTaskProtection' {Maybe [Text]
Text
cluster :: Text
tasks :: Maybe [Text]
$sel:cluster:GetTaskProtection' :: GetTaskProtection -> Text
$sel:tasks:GetTaskProtection' :: GetTaskProtection -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
tasks
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
cluster
instance Prelude.NFData GetTaskProtection where
rnf :: GetTaskProtection -> ()
rnf GetTaskProtection' {Maybe [Text]
Text
cluster :: Text
tasks :: Maybe [Text]
$sel:cluster:GetTaskProtection' :: GetTaskProtection -> Text
$sel:tasks:GetTaskProtection' :: GetTaskProtection -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
tasks seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
cluster
instance Data.ToHeaders GetTaskProtection where
toHeaders :: GetTaskProtection -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonEC2ContainerServiceV20141113.GetTaskProtection" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetTaskProtection where
toJSON :: GetTaskProtection -> Value
toJSON GetTaskProtection' {Maybe [Text]
Text
cluster :: Text
tasks :: Maybe [Text]
$sel:cluster:GetTaskProtection' :: GetTaskProtection -> Text
$sel:tasks:GetTaskProtection' :: GetTaskProtection -> Maybe [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"tasks" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
tasks,
forall a. a -> Maybe a
Prelude.Just (Key
"cluster" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
cluster)
]
)
instance Data.ToPath GetTaskProtection where
toPath :: GetTaskProtection -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetTaskProtection where
toQuery :: GetTaskProtection -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetTaskProtectionResponse = GetTaskProtectionResponse'
{
GetTaskProtectionResponse -> Maybe [Failure]
failures :: Prelude.Maybe [Failure],
GetTaskProtectionResponse -> Maybe [ProtectedTask]
protectedTasks :: Prelude.Maybe [ProtectedTask],
GetTaskProtectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTaskProtectionResponse -> GetTaskProtectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTaskProtectionResponse -> GetTaskProtectionResponse -> Bool
$c/= :: GetTaskProtectionResponse -> GetTaskProtectionResponse -> Bool
== :: GetTaskProtectionResponse -> GetTaskProtectionResponse -> Bool
$c== :: GetTaskProtectionResponse -> GetTaskProtectionResponse -> Bool
Prelude.Eq, ReadPrec [GetTaskProtectionResponse]
ReadPrec GetTaskProtectionResponse
Int -> ReadS GetTaskProtectionResponse
ReadS [GetTaskProtectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTaskProtectionResponse]
$creadListPrec :: ReadPrec [GetTaskProtectionResponse]
readPrec :: ReadPrec GetTaskProtectionResponse
$creadPrec :: ReadPrec GetTaskProtectionResponse
readList :: ReadS [GetTaskProtectionResponse]
$creadList :: ReadS [GetTaskProtectionResponse]
readsPrec :: Int -> ReadS GetTaskProtectionResponse
$creadsPrec :: Int -> ReadS GetTaskProtectionResponse
Prelude.Read, Int -> GetTaskProtectionResponse -> ShowS
[GetTaskProtectionResponse] -> ShowS
GetTaskProtectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTaskProtectionResponse] -> ShowS
$cshowList :: [GetTaskProtectionResponse] -> ShowS
show :: GetTaskProtectionResponse -> String
$cshow :: GetTaskProtectionResponse -> String
showsPrec :: Int -> GetTaskProtectionResponse -> ShowS
$cshowsPrec :: Int -> GetTaskProtectionResponse -> ShowS
Prelude.Show, forall x.
Rep GetTaskProtectionResponse x -> GetTaskProtectionResponse
forall x.
GetTaskProtectionResponse -> Rep GetTaskProtectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetTaskProtectionResponse x -> GetTaskProtectionResponse
$cfrom :: forall x.
GetTaskProtectionResponse -> Rep GetTaskProtectionResponse x
Prelude.Generic)
newGetTaskProtectionResponse ::
Prelude.Int ->
GetTaskProtectionResponse
newGetTaskProtectionResponse :: Int -> GetTaskProtectionResponse
newGetTaskProtectionResponse Int
pHttpStatus_ =
GetTaskProtectionResponse'
{ $sel:failures:GetTaskProtectionResponse' :: Maybe [Failure]
failures =
forall a. Maybe a
Prelude.Nothing,
$sel:protectedTasks:GetTaskProtectionResponse' :: Maybe [ProtectedTask]
protectedTasks = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTaskProtectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTaskProtectionResponse_failures :: Lens.Lens' GetTaskProtectionResponse (Prelude.Maybe [Failure])
getTaskProtectionResponse_failures :: Lens' GetTaskProtectionResponse (Maybe [Failure])
getTaskProtectionResponse_failures = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTaskProtectionResponse' {Maybe [Failure]
failures :: Maybe [Failure]
$sel:failures:GetTaskProtectionResponse' :: GetTaskProtectionResponse -> Maybe [Failure]
failures} -> Maybe [Failure]
failures) (\s :: GetTaskProtectionResponse
s@GetTaskProtectionResponse' {} Maybe [Failure]
a -> GetTaskProtectionResponse
s {$sel:failures:GetTaskProtectionResponse' :: Maybe [Failure]
failures = Maybe [Failure]
a} :: GetTaskProtectionResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getTaskProtectionResponse_protectedTasks :: Lens.Lens' GetTaskProtectionResponse (Prelude.Maybe [ProtectedTask])
getTaskProtectionResponse_protectedTasks :: Lens' GetTaskProtectionResponse (Maybe [ProtectedTask])
getTaskProtectionResponse_protectedTasks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTaskProtectionResponse' {Maybe [ProtectedTask]
protectedTasks :: Maybe [ProtectedTask]
$sel:protectedTasks:GetTaskProtectionResponse' :: GetTaskProtectionResponse -> Maybe [ProtectedTask]
protectedTasks} -> Maybe [ProtectedTask]
protectedTasks) (\s :: GetTaskProtectionResponse
s@GetTaskProtectionResponse' {} Maybe [ProtectedTask]
a -> GetTaskProtectionResponse
s {$sel:protectedTasks:GetTaskProtectionResponse' :: Maybe [ProtectedTask]
protectedTasks = Maybe [ProtectedTask]
a} :: GetTaskProtectionResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getTaskProtectionResponse_httpStatus :: Lens.Lens' GetTaskProtectionResponse Prelude.Int
getTaskProtectionResponse_httpStatus :: Lens' GetTaskProtectionResponse Int
getTaskProtectionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTaskProtectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTaskProtectionResponse' :: GetTaskProtectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTaskProtectionResponse
s@GetTaskProtectionResponse' {} Int
a -> GetTaskProtectionResponse
s {$sel:httpStatus:GetTaskProtectionResponse' :: Int
httpStatus = Int
a} :: GetTaskProtectionResponse)
instance Prelude.NFData GetTaskProtectionResponse where
rnf :: GetTaskProtectionResponse -> ()
rnf GetTaskProtectionResponse' {Int
Maybe [Failure]
Maybe [ProtectedTask]
httpStatus :: Int
protectedTasks :: Maybe [ProtectedTask]
failures :: Maybe [Failure]
$sel:httpStatus:GetTaskProtectionResponse' :: GetTaskProtectionResponse -> Int
$sel:protectedTasks:GetTaskProtectionResponse' :: GetTaskProtectionResponse -> Maybe [ProtectedTask]
$sel:failures:GetTaskProtectionResponse' :: GetTaskProtectionResponse -> Maybe [Failure]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Failure]
failures
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ProtectedTask]
protectedTasks
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus