{-# 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.ELB.DescribeInstanceHealth
(
DescribeInstanceHealth (..),
newDescribeInstanceHealth,
describeInstanceHealth_instances,
describeInstanceHealth_loadBalancerName,
DescribeInstanceHealthResponse (..),
newDescribeInstanceHealthResponse,
describeInstanceHealthResponse_instanceStates,
describeInstanceHealthResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ELB.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 DescribeInstanceHealth = DescribeInstanceHealth'
{
DescribeInstanceHealth -> Maybe [Instance]
instances :: Prelude.Maybe [Instance],
DescribeInstanceHealth -> Text
loadBalancerName :: Prelude.Text
}
deriving (DescribeInstanceHealth -> DescribeInstanceHealth -> Bool
(DescribeInstanceHealth -> DescribeInstanceHealth -> Bool)
-> (DescribeInstanceHealth -> DescribeInstanceHealth -> Bool)
-> Eq DescribeInstanceHealth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstanceHealth -> DescribeInstanceHealth -> Bool
$c/= :: DescribeInstanceHealth -> DescribeInstanceHealth -> Bool
== :: DescribeInstanceHealth -> DescribeInstanceHealth -> Bool
$c== :: DescribeInstanceHealth -> DescribeInstanceHealth -> Bool
Prelude.Eq, ReadPrec [DescribeInstanceHealth]
ReadPrec DescribeInstanceHealth
Int -> ReadS DescribeInstanceHealth
ReadS [DescribeInstanceHealth]
(Int -> ReadS DescribeInstanceHealth)
-> ReadS [DescribeInstanceHealth]
-> ReadPrec DescribeInstanceHealth
-> ReadPrec [DescribeInstanceHealth]
-> Read DescribeInstanceHealth
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInstanceHealth]
$creadListPrec :: ReadPrec [DescribeInstanceHealth]
readPrec :: ReadPrec DescribeInstanceHealth
$creadPrec :: ReadPrec DescribeInstanceHealth
readList :: ReadS [DescribeInstanceHealth]
$creadList :: ReadS [DescribeInstanceHealth]
readsPrec :: Int -> ReadS DescribeInstanceHealth
$creadsPrec :: Int -> ReadS DescribeInstanceHealth
Prelude.Read, Int -> DescribeInstanceHealth -> ShowS
[DescribeInstanceHealth] -> ShowS
DescribeInstanceHealth -> String
(Int -> DescribeInstanceHealth -> ShowS)
-> (DescribeInstanceHealth -> String)
-> ([DescribeInstanceHealth] -> ShowS)
-> Show DescribeInstanceHealth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstanceHealth] -> ShowS
$cshowList :: [DescribeInstanceHealth] -> ShowS
show :: DescribeInstanceHealth -> String
$cshow :: DescribeInstanceHealth -> String
showsPrec :: Int -> DescribeInstanceHealth -> ShowS
$cshowsPrec :: Int -> DescribeInstanceHealth -> ShowS
Prelude.Show, (forall x. DescribeInstanceHealth -> Rep DescribeInstanceHealth x)
-> (forall x.
Rep DescribeInstanceHealth x -> DescribeInstanceHealth)
-> Generic DescribeInstanceHealth
forall x. Rep DescribeInstanceHealth x -> DescribeInstanceHealth
forall x. DescribeInstanceHealth -> Rep DescribeInstanceHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeInstanceHealth x -> DescribeInstanceHealth
$cfrom :: forall x. DescribeInstanceHealth -> Rep DescribeInstanceHealth x
Prelude.Generic)
newDescribeInstanceHealth ::
Prelude.Text ->
DescribeInstanceHealth
newDescribeInstanceHealth :: Text -> DescribeInstanceHealth
newDescribeInstanceHealth Text
pLoadBalancerName_ =
DescribeInstanceHealth' :: Maybe [Instance] -> Text -> DescribeInstanceHealth
DescribeInstanceHealth'
{ $sel:instances:DescribeInstanceHealth' :: Maybe [Instance]
instances =
Maybe [Instance]
forall a. Maybe a
Prelude.Nothing,
$sel:loadBalancerName:DescribeInstanceHealth' :: Text
loadBalancerName = Text
pLoadBalancerName_
}
describeInstanceHealth_instances :: Lens.Lens' DescribeInstanceHealth (Prelude.Maybe [Instance])
describeInstanceHealth_instances :: (Maybe [Instance] -> f (Maybe [Instance]))
-> DescribeInstanceHealth -> f DescribeInstanceHealth
describeInstanceHealth_instances = (DescribeInstanceHealth -> Maybe [Instance])
-> (DescribeInstanceHealth
-> Maybe [Instance] -> DescribeInstanceHealth)
-> Lens
DescribeInstanceHealth
DescribeInstanceHealth
(Maybe [Instance])
(Maybe [Instance])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceHealth' {Maybe [Instance]
instances :: Maybe [Instance]
$sel:instances:DescribeInstanceHealth' :: DescribeInstanceHealth -> Maybe [Instance]
instances} -> Maybe [Instance]
instances) (\s :: DescribeInstanceHealth
s@DescribeInstanceHealth' {} Maybe [Instance]
a -> DescribeInstanceHealth
s {$sel:instances:DescribeInstanceHealth' :: Maybe [Instance]
instances = Maybe [Instance]
a} :: DescribeInstanceHealth) ((Maybe [Instance] -> f (Maybe [Instance]))
-> DescribeInstanceHealth -> f DescribeInstanceHealth)
-> ((Maybe [Instance] -> f (Maybe [Instance]))
-> Maybe [Instance] -> f (Maybe [Instance]))
-> (Maybe [Instance] -> f (Maybe [Instance]))
-> DescribeInstanceHealth
-> f DescribeInstanceHealth
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Instance] [Instance] [Instance] [Instance]
-> Iso
(Maybe [Instance])
(Maybe [Instance])
(Maybe [Instance])
(Maybe [Instance])
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 [Instance] [Instance] [Instance] [Instance]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeInstanceHealth_loadBalancerName :: Lens.Lens' DescribeInstanceHealth Prelude.Text
describeInstanceHealth_loadBalancerName :: (Text -> f Text)
-> DescribeInstanceHealth -> f DescribeInstanceHealth
describeInstanceHealth_loadBalancerName = (DescribeInstanceHealth -> Text)
-> (DescribeInstanceHealth -> Text -> DescribeInstanceHealth)
-> Lens DescribeInstanceHealth DescribeInstanceHealth Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceHealth' {Text
loadBalancerName :: Text
$sel:loadBalancerName:DescribeInstanceHealth' :: DescribeInstanceHealth -> Text
loadBalancerName} -> Text
loadBalancerName) (\s :: DescribeInstanceHealth
s@DescribeInstanceHealth' {} Text
a -> DescribeInstanceHealth
s {$sel:loadBalancerName:DescribeInstanceHealth' :: Text
loadBalancerName = Text
a} :: DescribeInstanceHealth)
instance Core.AWSRequest DescribeInstanceHealth where
type
AWSResponse DescribeInstanceHealth =
DescribeInstanceHealthResponse
request :: DescribeInstanceHealth -> Request DescribeInstanceHealth
request = Service -> DescribeInstanceHealth -> Request DescribeInstanceHealth
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeInstanceHealth
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeInstanceHealth)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DescribeInstanceHealth))
-> Logger
-> Service
-> Proxy DescribeInstanceHealth
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeInstanceHealth)))
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
"DescribeInstanceHealthResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [InstanceState] -> Int -> DescribeInstanceHealthResponse
DescribeInstanceHealthResponse'
(Maybe [InstanceState] -> Int -> DescribeInstanceHealthResponse)
-> Either String (Maybe [InstanceState])
-> Either String (Int -> DescribeInstanceHealthResponse)
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
"InstanceStates" 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 [InstanceState]))
-> Either String (Maybe [InstanceState])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [InstanceState])
-> [Node] -> Either String (Maybe [InstanceState])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [InstanceState]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> DescribeInstanceHealthResponse)
-> Either String Int
-> Either String DescribeInstanceHealthResponse
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 DescribeInstanceHealth
instance Prelude.NFData DescribeInstanceHealth
instance Core.ToHeaders DescribeInstanceHealth where
toHeaders :: DescribeInstanceHealth -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeInstanceHealth -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeInstanceHealth where
toPath :: DescribeInstanceHealth -> ByteString
toPath = ByteString -> DescribeInstanceHealth -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeInstanceHealth where
toQuery :: DescribeInstanceHealth -> QueryString
toQuery DescribeInstanceHealth' {Maybe [Instance]
Text
loadBalancerName :: Text
instances :: Maybe [Instance]
$sel:loadBalancerName:DescribeInstanceHealth' :: DescribeInstanceHealth -> Text
$sel:instances:DescribeInstanceHealth' :: DescribeInstanceHealth -> Maybe [Instance]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeInstanceHealth" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-06-01" :: Prelude.ByteString),
ByteString
"Instances"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Instance] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Instance] -> QueryString)
-> Maybe [Instance] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Instance]
instances),
ByteString
"LoadBalancerName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
loadBalancerName
]
data DescribeInstanceHealthResponse = DescribeInstanceHealthResponse'
{
DescribeInstanceHealthResponse -> Maybe [InstanceState]
instanceStates :: Prelude.Maybe [InstanceState],
DescribeInstanceHealthResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeInstanceHealthResponse
-> DescribeInstanceHealthResponse -> Bool
(DescribeInstanceHealthResponse
-> DescribeInstanceHealthResponse -> Bool)
-> (DescribeInstanceHealthResponse
-> DescribeInstanceHealthResponse -> Bool)
-> Eq DescribeInstanceHealthResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstanceHealthResponse
-> DescribeInstanceHealthResponse -> Bool
$c/= :: DescribeInstanceHealthResponse
-> DescribeInstanceHealthResponse -> Bool
== :: DescribeInstanceHealthResponse
-> DescribeInstanceHealthResponse -> Bool
$c== :: DescribeInstanceHealthResponse
-> DescribeInstanceHealthResponse -> Bool
Prelude.Eq, ReadPrec [DescribeInstanceHealthResponse]
ReadPrec DescribeInstanceHealthResponse
Int -> ReadS DescribeInstanceHealthResponse
ReadS [DescribeInstanceHealthResponse]
(Int -> ReadS DescribeInstanceHealthResponse)
-> ReadS [DescribeInstanceHealthResponse]
-> ReadPrec DescribeInstanceHealthResponse
-> ReadPrec [DescribeInstanceHealthResponse]
-> Read DescribeInstanceHealthResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInstanceHealthResponse]
$creadListPrec :: ReadPrec [DescribeInstanceHealthResponse]
readPrec :: ReadPrec DescribeInstanceHealthResponse
$creadPrec :: ReadPrec DescribeInstanceHealthResponse
readList :: ReadS [DescribeInstanceHealthResponse]
$creadList :: ReadS [DescribeInstanceHealthResponse]
readsPrec :: Int -> ReadS DescribeInstanceHealthResponse
$creadsPrec :: Int -> ReadS DescribeInstanceHealthResponse
Prelude.Read, Int -> DescribeInstanceHealthResponse -> ShowS
[DescribeInstanceHealthResponse] -> ShowS
DescribeInstanceHealthResponse -> String
(Int -> DescribeInstanceHealthResponse -> ShowS)
-> (DescribeInstanceHealthResponse -> String)
-> ([DescribeInstanceHealthResponse] -> ShowS)
-> Show DescribeInstanceHealthResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstanceHealthResponse] -> ShowS
$cshowList :: [DescribeInstanceHealthResponse] -> ShowS
show :: DescribeInstanceHealthResponse -> String
$cshow :: DescribeInstanceHealthResponse -> String
showsPrec :: Int -> DescribeInstanceHealthResponse -> ShowS
$cshowsPrec :: Int -> DescribeInstanceHealthResponse -> ShowS
Prelude.Show, (forall x.
DescribeInstanceHealthResponse
-> Rep DescribeInstanceHealthResponse x)
-> (forall x.
Rep DescribeInstanceHealthResponse x
-> DescribeInstanceHealthResponse)
-> Generic DescribeInstanceHealthResponse
forall x.
Rep DescribeInstanceHealthResponse x
-> DescribeInstanceHealthResponse
forall x.
DescribeInstanceHealthResponse
-> Rep DescribeInstanceHealthResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeInstanceHealthResponse x
-> DescribeInstanceHealthResponse
$cfrom :: forall x.
DescribeInstanceHealthResponse
-> Rep DescribeInstanceHealthResponse x
Prelude.Generic)
newDescribeInstanceHealthResponse ::
Prelude.Int ->
DescribeInstanceHealthResponse
newDescribeInstanceHealthResponse :: Int -> DescribeInstanceHealthResponse
newDescribeInstanceHealthResponse Int
pHttpStatus_ =
DescribeInstanceHealthResponse' :: Maybe [InstanceState] -> Int -> DescribeInstanceHealthResponse
DescribeInstanceHealthResponse'
{ $sel:instanceStates:DescribeInstanceHealthResponse' :: Maybe [InstanceState]
instanceStates =
Maybe [InstanceState]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeInstanceHealthResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeInstanceHealthResponse_instanceStates :: Lens.Lens' DescribeInstanceHealthResponse (Prelude.Maybe [InstanceState])
describeInstanceHealthResponse_instanceStates :: (Maybe [InstanceState] -> f (Maybe [InstanceState]))
-> DescribeInstanceHealthResponse
-> f DescribeInstanceHealthResponse
describeInstanceHealthResponse_instanceStates = (DescribeInstanceHealthResponse -> Maybe [InstanceState])
-> (DescribeInstanceHealthResponse
-> Maybe [InstanceState] -> DescribeInstanceHealthResponse)
-> Lens
DescribeInstanceHealthResponse
DescribeInstanceHealthResponse
(Maybe [InstanceState])
(Maybe [InstanceState])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceHealthResponse' {Maybe [InstanceState]
instanceStates :: Maybe [InstanceState]
$sel:instanceStates:DescribeInstanceHealthResponse' :: DescribeInstanceHealthResponse -> Maybe [InstanceState]
instanceStates} -> Maybe [InstanceState]
instanceStates) (\s :: DescribeInstanceHealthResponse
s@DescribeInstanceHealthResponse' {} Maybe [InstanceState]
a -> DescribeInstanceHealthResponse
s {$sel:instanceStates:DescribeInstanceHealthResponse' :: Maybe [InstanceState]
instanceStates = Maybe [InstanceState]
a} :: DescribeInstanceHealthResponse) ((Maybe [InstanceState] -> f (Maybe [InstanceState]))
-> DescribeInstanceHealthResponse
-> f DescribeInstanceHealthResponse)
-> ((Maybe [InstanceState] -> f (Maybe [InstanceState]))
-> Maybe [InstanceState] -> f (Maybe [InstanceState]))
-> (Maybe [InstanceState] -> f (Maybe [InstanceState]))
-> DescribeInstanceHealthResponse
-> f DescribeInstanceHealthResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[InstanceState] [InstanceState] [InstanceState] [InstanceState]
-> Iso
(Maybe [InstanceState])
(Maybe [InstanceState])
(Maybe [InstanceState])
(Maybe [InstanceState])
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
[InstanceState] [InstanceState] [InstanceState] [InstanceState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeInstanceHealthResponse_httpStatus :: Lens.Lens' DescribeInstanceHealthResponse Prelude.Int
describeInstanceHealthResponse_httpStatus :: (Int -> f Int)
-> DescribeInstanceHealthResponse
-> f DescribeInstanceHealthResponse
describeInstanceHealthResponse_httpStatus = (DescribeInstanceHealthResponse -> Int)
-> (DescribeInstanceHealthResponse
-> Int -> DescribeInstanceHealthResponse)
-> Lens
DescribeInstanceHealthResponse
DescribeInstanceHealthResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceHealthResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeInstanceHealthResponse' :: DescribeInstanceHealthResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeInstanceHealthResponse
s@DescribeInstanceHealthResponse' {} Int
a -> DescribeInstanceHealthResponse
s {$sel:httpStatus:DescribeInstanceHealthResponse' :: Int
httpStatus = Int
a} :: DescribeInstanceHealthResponse)
instance
Prelude.NFData
DescribeInstanceHealthResponse