{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.ELBV2.Types.TargetHealth -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) module Amazonka.ELBV2.Types.TargetHealth where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.ELBV2.Types.TargetHealthReasonEnum import Amazonka.ELBV2.Types.TargetHealthStateEnum import qualified Amazonka.Prelude as Prelude -- | Information about the current health of a target. -- -- /See:/ 'newTargetHealth' smart constructor. data TargetHealth = TargetHealth' { -- | A description of the target health that provides additional details. If -- the state is @healthy@, a description is not provided. TargetHealth -> Maybe Text description :: Prelude.Maybe Prelude.Text, -- | The reason code. -- -- If the target state is @healthy@, a reason code is not provided. -- -- If the target state is @initial@, the reason code can be one of the -- following values: -- -- - @Elb.RegistrationInProgress@ - The target is in the process of being -- registered with the load balancer. -- -- - @Elb.InitialHealthChecking@ - The load balancer is still sending the -- target the minimum number of health checks required to determine its -- health status. -- -- If the target state is @unhealthy@, the reason code can be one of the -- following values: -- -- - @Target.ResponseCodeMismatch@ - The health checks did not return an -- expected HTTP code. Applies only to Application Load Balancers and -- Gateway Load Balancers. -- -- - @Target.Timeout@ - The health check requests timed out. Applies only -- to Application Load Balancers and Gateway Load Balancers. -- -- - @Target.FailedHealthChecks@ - The load balancer received an error -- while establishing a connection to the target or the target response -- was malformed. -- -- - @Elb.InternalError@ - The health checks failed due to an internal -- error. Applies only to Application Load Balancers. -- -- If the target state is @unused@, the reason code can be one of the -- following values: -- -- - @Target.NotRegistered@ - The target is not registered with the -- target group. -- -- - @Target.NotInUse@ - The target group is not used by any load -- balancer or the target is in an Availability Zone that is not -- enabled for its load balancer. -- -- - @Target.InvalidState@ - The target is in the stopped or terminated -- state. -- -- - @Target.IpUnusable@ - The target IP address is reserved for use by a -- load balancer. -- -- If the target state is @draining@, the reason code can be the following -- value: -- -- - @Target.DeregistrationInProgress@ - The target is in the process of -- being deregistered and the deregistration delay period has not -- expired. -- -- If the target state is @unavailable@, the reason code can be the -- following value: -- -- - @Target.HealthCheckDisabled@ - Health checks are disabled for the -- target group. Applies only to Application Load Balancers. -- -- - @Elb.InternalError@ - Target health is unavailable due to an -- internal error. Applies only to Network Load Balancers. TargetHealth -> Maybe TargetHealthReasonEnum reason :: Prelude.Maybe TargetHealthReasonEnum, -- | The state of the target. TargetHealth -> Maybe TargetHealthStateEnum state :: Prelude.Maybe TargetHealthStateEnum } deriving (TargetHealth -> TargetHealth -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: TargetHealth -> TargetHealth -> Bool $c/= :: TargetHealth -> TargetHealth -> Bool == :: TargetHealth -> TargetHealth -> Bool $c== :: TargetHealth -> TargetHealth -> Bool Prelude.Eq, ReadPrec [TargetHealth] ReadPrec TargetHealth Int -> ReadS TargetHealth ReadS [TargetHealth] forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [TargetHealth] $creadListPrec :: ReadPrec [TargetHealth] readPrec :: ReadPrec TargetHealth $creadPrec :: ReadPrec TargetHealth readList :: ReadS [TargetHealth] $creadList :: ReadS [TargetHealth] readsPrec :: Int -> ReadS TargetHealth $creadsPrec :: Int -> ReadS TargetHealth Prelude.Read, Int -> TargetHealth -> ShowS [TargetHealth] -> ShowS TargetHealth -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [TargetHealth] -> ShowS $cshowList :: [TargetHealth] -> ShowS show :: TargetHealth -> String $cshow :: TargetHealth -> String showsPrec :: Int -> TargetHealth -> ShowS $cshowsPrec :: Int -> TargetHealth -> ShowS Prelude.Show, forall x. Rep TargetHealth x -> TargetHealth forall x. TargetHealth -> Rep TargetHealth x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep TargetHealth x -> TargetHealth $cfrom :: forall x. TargetHealth -> Rep TargetHealth x Prelude.Generic) -- | -- Create a value of 'TargetHealth' with all optional fields omitted. -- -- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'description', 'targetHealth_description' - A description of the target health that provides additional details. If -- the state is @healthy@, a description is not provided. -- -- 'reason', 'targetHealth_reason' - The reason code. -- -- If the target state is @healthy@, a reason code is not provided. -- -- If the target state is @initial@, the reason code can be one of the -- following values: -- -- - @Elb.RegistrationInProgress@ - The target is in the process of being -- registered with the load balancer. -- -- - @Elb.InitialHealthChecking@ - The load balancer is still sending the -- target the minimum number of health checks required to determine its -- health status. -- -- If the target state is @unhealthy@, the reason code can be one of the -- following values: -- -- - @Target.ResponseCodeMismatch@ - The health checks did not return an -- expected HTTP code. Applies only to Application Load Balancers and -- Gateway Load Balancers. -- -- - @Target.Timeout@ - The health check requests timed out. Applies only -- to Application Load Balancers and Gateway Load Balancers. -- -- - @Target.FailedHealthChecks@ - The load balancer received an error -- while establishing a connection to the target or the target response -- was malformed. -- -- - @Elb.InternalError@ - The health checks failed due to an internal -- error. Applies only to Application Load Balancers. -- -- If the target state is @unused@, the reason code can be one of the -- following values: -- -- - @Target.NotRegistered@ - The target is not registered with the -- target group. -- -- - @Target.NotInUse@ - The target group is not used by any load -- balancer or the target is in an Availability Zone that is not -- enabled for its load balancer. -- -- - @Target.InvalidState@ - The target is in the stopped or terminated -- state. -- -- - @Target.IpUnusable@ - The target IP address is reserved for use by a -- load balancer. -- -- If the target state is @draining@, the reason code can be the following -- value: -- -- - @Target.DeregistrationInProgress@ - The target is in the process of -- being deregistered and the deregistration delay period has not -- expired. -- -- If the target state is @unavailable@, the reason code can be the -- following value: -- -- - @Target.HealthCheckDisabled@ - Health checks are disabled for the -- target group. Applies only to Application Load Balancers. -- -- - @Elb.InternalError@ - Target health is unavailable due to an -- internal error. Applies only to Network Load Balancers. -- -- 'state', 'targetHealth_state' - The state of the target. newTargetHealth :: TargetHealth newTargetHealth :: TargetHealth newTargetHealth = TargetHealth' { $sel:description:TargetHealth' :: Maybe Text description = forall a. Maybe a Prelude.Nothing, $sel:reason:TargetHealth' :: Maybe TargetHealthReasonEnum reason = forall a. Maybe a Prelude.Nothing, $sel:state:TargetHealth' :: Maybe TargetHealthStateEnum state = forall a. Maybe a Prelude.Nothing } -- | A description of the target health that provides additional details. If -- the state is @healthy@, a description is not provided. targetHealth_description :: Lens.Lens' TargetHealth (Prelude.Maybe Prelude.Text) targetHealth_description :: Lens' TargetHealth (Maybe Text) targetHealth_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\TargetHealth' {Maybe Text description :: Maybe Text $sel:description:TargetHealth' :: TargetHealth -> Maybe Text description} -> Maybe Text description) (\s :: TargetHealth s@TargetHealth' {} Maybe Text a -> TargetHealth s {$sel:description:TargetHealth' :: Maybe Text description = Maybe Text a} :: TargetHealth) -- | The reason code. -- -- If the target state is @healthy@, a reason code is not provided. -- -- If the target state is @initial@, the reason code can be one of the -- following values: -- -- - @Elb.RegistrationInProgress@ - The target is in the process of being -- registered with the load balancer. -- -- - @Elb.InitialHealthChecking@ - The load balancer is still sending the -- target the minimum number of health checks required to determine its -- health status. -- -- If the target state is @unhealthy@, the reason code can be one of the -- following values: -- -- - @Target.ResponseCodeMismatch@ - The health checks did not return an -- expected HTTP code. Applies only to Application Load Balancers and -- Gateway Load Balancers. -- -- - @Target.Timeout@ - The health check requests timed out. Applies only -- to Application Load Balancers and Gateway Load Balancers. -- -- - @Target.FailedHealthChecks@ - The load balancer received an error -- while establishing a connection to the target or the target response -- was malformed. -- -- - @Elb.InternalError@ - The health checks failed due to an internal -- error. Applies only to Application Load Balancers. -- -- If the target state is @unused@, the reason code can be one of the -- following values: -- -- - @Target.NotRegistered@ - The target is not registered with the -- target group. -- -- - @Target.NotInUse@ - The target group is not used by any load -- balancer or the target is in an Availability Zone that is not -- enabled for its load balancer. -- -- - @Target.InvalidState@ - The target is in the stopped or terminated -- state. -- -- - @Target.IpUnusable@ - The target IP address is reserved for use by a -- load balancer. -- -- If the target state is @draining@, the reason code can be the following -- value: -- -- - @Target.DeregistrationInProgress@ - The target is in the process of -- being deregistered and the deregistration delay period has not -- expired. -- -- If the target state is @unavailable@, the reason code can be the -- following value: -- -- - @Target.HealthCheckDisabled@ - Health checks are disabled for the -- target group. Applies only to Application Load Balancers. -- -- - @Elb.InternalError@ - Target health is unavailable due to an -- internal error. Applies only to Network Load Balancers. targetHealth_reason :: Lens.Lens' TargetHealth (Prelude.Maybe TargetHealthReasonEnum) targetHealth_reason :: Lens' TargetHealth (Maybe TargetHealthReasonEnum) targetHealth_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\TargetHealth' {Maybe TargetHealthReasonEnum reason :: Maybe TargetHealthReasonEnum $sel:reason:TargetHealth' :: TargetHealth -> Maybe TargetHealthReasonEnum reason} -> Maybe TargetHealthReasonEnum reason) (\s :: TargetHealth s@TargetHealth' {} Maybe TargetHealthReasonEnum a -> TargetHealth s {$sel:reason:TargetHealth' :: Maybe TargetHealthReasonEnum reason = Maybe TargetHealthReasonEnum a} :: TargetHealth) -- | The state of the target. targetHealth_state :: Lens.Lens' TargetHealth (Prelude.Maybe TargetHealthStateEnum) targetHealth_state :: Lens' TargetHealth (Maybe TargetHealthStateEnum) targetHealth_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\TargetHealth' {Maybe TargetHealthStateEnum state :: Maybe TargetHealthStateEnum $sel:state:TargetHealth' :: TargetHealth -> Maybe TargetHealthStateEnum state} -> Maybe TargetHealthStateEnum state) (\s :: TargetHealth s@TargetHealth' {} Maybe TargetHealthStateEnum a -> TargetHealth s {$sel:state:TargetHealth' :: Maybe TargetHealthStateEnum state = Maybe TargetHealthStateEnum a} :: TargetHealth) instance Data.FromXML TargetHealth where parseXML :: [Node] -> Either String TargetHealth parseXML [Node] x = Maybe Text -> Maybe TargetHealthReasonEnum -> Maybe TargetHealthStateEnum -> TargetHealth TargetHealth' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> ([Node] x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a) Data..@? Text "Description") forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> ([Node] x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a) Data..@? Text "Reason") forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> ([Node] x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a) Data..@? Text "State") instance Prelude.Hashable TargetHealth where hashWithSalt :: Int -> TargetHealth -> Int hashWithSalt Int _salt TargetHealth' {Maybe Text Maybe TargetHealthReasonEnum Maybe TargetHealthStateEnum state :: Maybe TargetHealthStateEnum reason :: Maybe TargetHealthReasonEnum description :: Maybe Text $sel:state:TargetHealth' :: TargetHealth -> Maybe TargetHealthStateEnum $sel:reason:TargetHealth' :: TargetHealth -> Maybe TargetHealthReasonEnum $sel:description:TargetHealth' :: TargetHealth -> Maybe Text ..} = Int _salt forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` Maybe Text description forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` Maybe TargetHealthReasonEnum reason forall a. Hashable a => Int -> a -> Int `Prelude.hashWithSalt` Maybe TargetHealthStateEnum state instance Prelude.NFData TargetHealth where rnf :: TargetHealth -> () rnf TargetHealth' {Maybe Text Maybe TargetHealthReasonEnum Maybe TargetHealthStateEnum state :: Maybe TargetHealthStateEnum reason :: Maybe TargetHealthReasonEnum description :: Maybe Text $sel:state:TargetHealth' :: TargetHealth -> Maybe TargetHealthStateEnum $sel:reason:TargetHealth' :: TargetHealth -> Maybe TargetHealthReasonEnum $sel:description:TargetHealth' :: TargetHealth -> Maybe Text ..} = forall a. NFData a => a -> () Prelude.rnf Maybe Text description seq :: forall a b. a -> b -> b `Prelude.seq` forall a. NFData a => a -> () Prelude.rnf Maybe TargetHealthReasonEnum reason seq :: forall a b. a -> b -> b `Prelude.seq` forall a. NFData a => a -> () Prelude.rnf Maybe TargetHealthStateEnum state