{-# 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.ELBV2.DescribeTargetHealth
(
DescribeTargetHealth (..),
newDescribeTargetHealth,
describeTargetHealth_targets,
describeTargetHealth_targetGroupArn,
DescribeTargetHealthResponse (..),
newDescribeTargetHealthResponse,
describeTargetHealthResponse_targetHealthDescriptions,
describeTargetHealthResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ELBV2.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 DescribeTargetHealth = DescribeTargetHealth'
{
DescribeTargetHealth -> Maybe [TargetDescription]
targets :: Prelude.Maybe [TargetDescription],
DescribeTargetHealth -> Text
targetGroupArn :: Prelude.Text
}
deriving (DescribeTargetHealth -> DescribeTargetHealth -> Bool
(DescribeTargetHealth -> DescribeTargetHealth -> Bool)
-> (DescribeTargetHealth -> DescribeTargetHealth -> Bool)
-> Eq DescribeTargetHealth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTargetHealth -> DescribeTargetHealth -> Bool
$c/= :: DescribeTargetHealth -> DescribeTargetHealth -> Bool
== :: DescribeTargetHealth -> DescribeTargetHealth -> Bool
$c== :: DescribeTargetHealth -> DescribeTargetHealth -> Bool
Prelude.Eq, ReadPrec [DescribeTargetHealth]
ReadPrec DescribeTargetHealth
Int -> ReadS DescribeTargetHealth
ReadS [DescribeTargetHealth]
(Int -> ReadS DescribeTargetHealth)
-> ReadS [DescribeTargetHealth]
-> ReadPrec DescribeTargetHealth
-> ReadPrec [DescribeTargetHealth]
-> Read DescribeTargetHealth
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTargetHealth]
$creadListPrec :: ReadPrec [DescribeTargetHealth]
readPrec :: ReadPrec DescribeTargetHealth
$creadPrec :: ReadPrec DescribeTargetHealth
readList :: ReadS [DescribeTargetHealth]
$creadList :: ReadS [DescribeTargetHealth]
readsPrec :: Int -> ReadS DescribeTargetHealth
$creadsPrec :: Int -> ReadS DescribeTargetHealth
Prelude.Read, Int -> DescribeTargetHealth -> ShowS
[DescribeTargetHealth] -> ShowS
DescribeTargetHealth -> String
(Int -> DescribeTargetHealth -> ShowS)
-> (DescribeTargetHealth -> String)
-> ([DescribeTargetHealth] -> ShowS)
-> Show DescribeTargetHealth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTargetHealth] -> ShowS
$cshowList :: [DescribeTargetHealth] -> ShowS
show :: DescribeTargetHealth -> String
$cshow :: DescribeTargetHealth -> String
showsPrec :: Int -> DescribeTargetHealth -> ShowS
$cshowsPrec :: Int -> DescribeTargetHealth -> ShowS
Prelude.Show, (forall x. DescribeTargetHealth -> Rep DescribeTargetHealth x)
-> (forall x. Rep DescribeTargetHealth x -> DescribeTargetHealth)
-> Generic DescribeTargetHealth
forall x. Rep DescribeTargetHealth x -> DescribeTargetHealth
forall x. DescribeTargetHealth -> Rep DescribeTargetHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTargetHealth x -> DescribeTargetHealth
$cfrom :: forall x. DescribeTargetHealth -> Rep DescribeTargetHealth x
Prelude.Generic)
newDescribeTargetHealth ::
Prelude.Text ->
DescribeTargetHealth
newDescribeTargetHealth :: Text -> DescribeTargetHealth
newDescribeTargetHealth Text
pTargetGroupArn_ =
DescribeTargetHealth' :: Maybe [TargetDescription] -> Text -> DescribeTargetHealth
DescribeTargetHealth'
{ $sel:targets:DescribeTargetHealth' :: Maybe [TargetDescription]
targets = Maybe [TargetDescription]
forall a. Maybe a
Prelude.Nothing,
$sel:targetGroupArn:DescribeTargetHealth' :: Text
targetGroupArn = Text
pTargetGroupArn_
}
describeTargetHealth_targets :: Lens.Lens' DescribeTargetHealth (Prelude.Maybe [TargetDescription])
describeTargetHealth_targets :: (Maybe [TargetDescription] -> f (Maybe [TargetDescription]))
-> DescribeTargetHealth -> f DescribeTargetHealth
describeTargetHealth_targets = (DescribeTargetHealth -> Maybe [TargetDescription])
-> (DescribeTargetHealth
-> Maybe [TargetDescription] -> DescribeTargetHealth)
-> Lens
DescribeTargetHealth
DescribeTargetHealth
(Maybe [TargetDescription])
(Maybe [TargetDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTargetHealth' {Maybe [TargetDescription]
targets :: Maybe [TargetDescription]
$sel:targets:DescribeTargetHealth' :: DescribeTargetHealth -> Maybe [TargetDescription]
targets} -> Maybe [TargetDescription]
targets) (\s :: DescribeTargetHealth
s@DescribeTargetHealth' {} Maybe [TargetDescription]
a -> DescribeTargetHealth
s {$sel:targets:DescribeTargetHealth' :: Maybe [TargetDescription]
targets = Maybe [TargetDescription]
a} :: DescribeTargetHealth) ((Maybe [TargetDescription] -> f (Maybe [TargetDescription]))
-> DescribeTargetHealth -> f DescribeTargetHealth)
-> ((Maybe [TargetDescription] -> f (Maybe [TargetDescription]))
-> Maybe [TargetDescription] -> f (Maybe [TargetDescription]))
-> (Maybe [TargetDescription] -> f (Maybe [TargetDescription]))
-> DescribeTargetHealth
-> f DescribeTargetHealth
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[TargetDescription]
[TargetDescription]
[TargetDescription]
[TargetDescription]
-> Iso
(Maybe [TargetDescription])
(Maybe [TargetDescription])
(Maybe [TargetDescription])
(Maybe [TargetDescription])
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
[TargetDescription]
[TargetDescription]
[TargetDescription]
[TargetDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeTargetHealth_targetGroupArn :: Lens.Lens' DescribeTargetHealth Prelude.Text
describeTargetHealth_targetGroupArn :: (Text -> f Text) -> DescribeTargetHealth -> f DescribeTargetHealth
describeTargetHealth_targetGroupArn = (DescribeTargetHealth -> Text)
-> (DescribeTargetHealth -> Text -> DescribeTargetHealth)
-> Lens DescribeTargetHealth DescribeTargetHealth Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTargetHealth' {Text
targetGroupArn :: Text
$sel:targetGroupArn:DescribeTargetHealth' :: DescribeTargetHealth -> Text
targetGroupArn} -> Text
targetGroupArn) (\s :: DescribeTargetHealth
s@DescribeTargetHealth' {} Text
a -> DescribeTargetHealth
s {$sel:targetGroupArn:DescribeTargetHealth' :: Text
targetGroupArn = Text
a} :: DescribeTargetHealth)
instance Core.AWSRequest DescribeTargetHealth where
type
AWSResponse DescribeTargetHealth =
DescribeTargetHealthResponse
request :: DescribeTargetHealth -> Request DescribeTargetHealth
request = Service -> DescribeTargetHealth -> Request DescribeTargetHealth
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeTargetHealth
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeTargetHealth)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DescribeTargetHealth))
-> Logger
-> Service
-> Proxy DescribeTargetHealth
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeTargetHealth)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"DescribeTargetHealthResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [TargetHealthDescription]
-> Int -> DescribeTargetHealthResponse
DescribeTargetHealthResponse'
(Maybe [TargetHealthDescription]
-> Int -> DescribeTargetHealthResponse)
-> Either String (Maybe [TargetHealthDescription])
-> Either String (Int -> DescribeTargetHealthResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TargetHealthDescriptions"
Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [TargetHealthDescription]))
-> Either String (Maybe [TargetHealthDescription])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [TargetHealthDescription])
-> [Node] -> Either String (Maybe [TargetHealthDescription])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [TargetHealthDescription]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> DescribeTargetHealthResponse)
-> Either String Int -> Either String DescribeTargetHealthResponse
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 DescribeTargetHealth
instance Prelude.NFData DescribeTargetHealth
instance Core.ToHeaders DescribeTargetHealth where
toHeaders :: DescribeTargetHealth -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeTargetHealth -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeTargetHealth where
toPath :: DescribeTargetHealth -> ByteString
toPath = ByteString -> DescribeTargetHealth -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeTargetHealth where
toQuery :: DescribeTargetHealth -> QueryString
toQuery DescribeTargetHealth' {Maybe [TargetDescription]
Text
targetGroupArn :: Text
targets :: Maybe [TargetDescription]
$sel:targetGroupArn:DescribeTargetHealth' :: DescribeTargetHealth -> Text
$sel:targets:DescribeTargetHealth' :: DescribeTargetHealth -> Maybe [TargetDescription]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeTargetHealth" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
ByteString
"Targets"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [TargetDescription] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([TargetDescription] -> QueryString)
-> Maybe [TargetDescription] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TargetDescription]
targets),
ByteString
"TargetGroupArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
targetGroupArn
]
data DescribeTargetHealthResponse = DescribeTargetHealthResponse'
{
DescribeTargetHealthResponse -> Maybe [TargetHealthDescription]
targetHealthDescriptions :: Prelude.Maybe [TargetHealthDescription],
DescribeTargetHealthResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeTargetHealthResponse
-> DescribeTargetHealthResponse -> Bool
(DescribeTargetHealthResponse
-> DescribeTargetHealthResponse -> Bool)
-> (DescribeTargetHealthResponse
-> DescribeTargetHealthResponse -> Bool)
-> Eq DescribeTargetHealthResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTargetHealthResponse
-> DescribeTargetHealthResponse -> Bool
$c/= :: DescribeTargetHealthResponse
-> DescribeTargetHealthResponse -> Bool
== :: DescribeTargetHealthResponse
-> DescribeTargetHealthResponse -> Bool
$c== :: DescribeTargetHealthResponse
-> DescribeTargetHealthResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTargetHealthResponse]
ReadPrec DescribeTargetHealthResponse
Int -> ReadS DescribeTargetHealthResponse
ReadS [DescribeTargetHealthResponse]
(Int -> ReadS DescribeTargetHealthResponse)
-> ReadS [DescribeTargetHealthResponse]
-> ReadPrec DescribeTargetHealthResponse
-> ReadPrec [DescribeTargetHealthResponse]
-> Read DescribeTargetHealthResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTargetHealthResponse]
$creadListPrec :: ReadPrec [DescribeTargetHealthResponse]
readPrec :: ReadPrec DescribeTargetHealthResponse
$creadPrec :: ReadPrec DescribeTargetHealthResponse
readList :: ReadS [DescribeTargetHealthResponse]
$creadList :: ReadS [DescribeTargetHealthResponse]
readsPrec :: Int -> ReadS DescribeTargetHealthResponse
$creadsPrec :: Int -> ReadS DescribeTargetHealthResponse
Prelude.Read, Int -> DescribeTargetHealthResponse -> ShowS
[DescribeTargetHealthResponse] -> ShowS
DescribeTargetHealthResponse -> String
(Int -> DescribeTargetHealthResponse -> ShowS)
-> (DescribeTargetHealthResponse -> String)
-> ([DescribeTargetHealthResponse] -> ShowS)
-> Show DescribeTargetHealthResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTargetHealthResponse] -> ShowS
$cshowList :: [DescribeTargetHealthResponse] -> ShowS
show :: DescribeTargetHealthResponse -> String
$cshow :: DescribeTargetHealthResponse -> String
showsPrec :: Int -> DescribeTargetHealthResponse -> ShowS
$cshowsPrec :: Int -> DescribeTargetHealthResponse -> ShowS
Prelude.Show, (forall x.
DescribeTargetHealthResponse -> Rep DescribeTargetHealthResponse x)
-> (forall x.
Rep DescribeTargetHealthResponse x -> DescribeTargetHealthResponse)
-> Generic DescribeTargetHealthResponse
forall x.
Rep DescribeTargetHealthResponse x -> DescribeTargetHealthResponse
forall x.
DescribeTargetHealthResponse -> Rep DescribeTargetHealthResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTargetHealthResponse x -> DescribeTargetHealthResponse
$cfrom :: forall x.
DescribeTargetHealthResponse -> Rep DescribeTargetHealthResponse x
Prelude.Generic)
newDescribeTargetHealthResponse ::
Prelude.Int ->
DescribeTargetHealthResponse
newDescribeTargetHealthResponse :: Int -> DescribeTargetHealthResponse
newDescribeTargetHealthResponse Int
pHttpStatus_ =
DescribeTargetHealthResponse' :: Maybe [TargetHealthDescription]
-> Int -> DescribeTargetHealthResponse
DescribeTargetHealthResponse'
{ $sel:targetHealthDescriptions:DescribeTargetHealthResponse' :: Maybe [TargetHealthDescription]
targetHealthDescriptions =
Maybe [TargetHealthDescription]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeTargetHealthResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeTargetHealthResponse_targetHealthDescriptions :: Lens.Lens' DescribeTargetHealthResponse (Prelude.Maybe [TargetHealthDescription])
describeTargetHealthResponse_targetHealthDescriptions :: (Maybe [TargetHealthDescription]
-> f (Maybe [TargetHealthDescription]))
-> DescribeTargetHealthResponse -> f DescribeTargetHealthResponse
describeTargetHealthResponse_targetHealthDescriptions = (DescribeTargetHealthResponse -> Maybe [TargetHealthDescription])
-> (DescribeTargetHealthResponse
-> Maybe [TargetHealthDescription] -> DescribeTargetHealthResponse)
-> Lens
DescribeTargetHealthResponse
DescribeTargetHealthResponse
(Maybe [TargetHealthDescription])
(Maybe [TargetHealthDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTargetHealthResponse' {Maybe [TargetHealthDescription]
targetHealthDescriptions :: Maybe [TargetHealthDescription]
$sel:targetHealthDescriptions:DescribeTargetHealthResponse' :: DescribeTargetHealthResponse -> Maybe [TargetHealthDescription]
targetHealthDescriptions} -> Maybe [TargetHealthDescription]
targetHealthDescriptions) (\s :: DescribeTargetHealthResponse
s@DescribeTargetHealthResponse' {} Maybe [TargetHealthDescription]
a -> DescribeTargetHealthResponse
s {$sel:targetHealthDescriptions:DescribeTargetHealthResponse' :: Maybe [TargetHealthDescription]
targetHealthDescriptions = Maybe [TargetHealthDescription]
a} :: DescribeTargetHealthResponse) ((Maybe [TargetHealthDescription]
-> f (Maybe [TargetHealthDescription]))
-> DescribeTargetHealthResponse -> f DescribeTargetHealthResponse)
-> ((Maybe [TargetHealthDescription]
-> f (Maybe [TargetHealthDescription]))
-> Maybe [TargetHealthDescription]
-> f (Maybe [TargetHealthDescription]))
-> (Maybe [TargetHealthDescription]
-> f (Maybe [TargetHealthDescription]))
-> DescribeTargetHealthResponse
-> f DescribeTargetHealthResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[TargetHealthDescription]
[TargetHealthDescription]
[TargetHealthDescription]
[TargetHealthDescription]
-> Iso
(Maybe [TargetHealthDescription])
(Maybe [TargetHealthDescription])
(Maybe [TargetHealthDescription])
(Maybe [TargetHealthDescription])
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
[TargetHealthDescription]
[TargetHealthDescription]
[TargetHealthDescription]
[TargetHealthDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeTargetHealthResponse_httpStatus :: Lens.Lens' DescribeTargetHealthResponse Prelude.Int
describeTargetHealthResponse_httpStatus :: (Int -> f Int)
-> DescribeTargetHealthResponse -> f DescribeTargetHealthResponse
describeTargetHealthResponse_httpStatus = (DescribeTargetHealthResponse -> Int)
-> (DescribeTargetHealthResponse
-> Int -> DescribeTargetHealthResponse)
-> Lens
DescribeTargetHealthResponse DescribeTargetHealthResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTargetHealthResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeTargetHealthResponse' :: DescribeTargetHealthResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeTargetHealthResponse
s@DescribeTargetHealthResponse' {} Int
a -> DescribeTargetHealthResponse
s {$sel:httpStatus:DescribeTargetHealthResponse' :: Int
httpStatus = Int
a} :: DescribeTargetHealthResponse)
instance Prelude.NFData DescribeTargetHealthResponse