{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AutoScaling.DescribeLoadBalancers
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about the load balancers for the specified Auto Scaling
-- group.
--
-- This operation describes only Classic Load Balancers. If you have
-- Application Load Balancers, Network Load Balancers, or Gateway Load
-- Balancers, use the DescribeLoadBalancerTargetGroups API instead.
--
-- To determine the availability of registered instances, use the @State@
-- element in the response. When you attach a load balancer to an Auto
-- Scaling group, the initial @State@ value is @Adding@. The state
-- transitions to @Added@ after all Auto Scaling instances are registered
-- with the load balancer. If Elastic Load Balancing health checks are
-- enabled for the Auto Scaling group, the state transitions to @InService@
-- after at least one Auto Scaling instance passes the health check. When
-- the load balancer is in the @InService@ state, Amazon EC2 Auto Scaling
-- can terminate and replace any instances that are reported as unhealthy.
-- If no registered instances pass the health checks, the load balancer
-- doesn\'t enter the @InService@ state.
--
-- Load balancers also have an @InService@ state if you attach them in the
-- CreateAutoScalingGroup API call. If your load balancer state is
-- @InService@, but it is not working properly, check the scaling
-- activities by calling DescribeScalingActivities and take any corrective
-- actions necessary.
--
-- For help with failed health checks, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ts-as-healthchecks.html Troubleshooting Amazon EC2 Auto Scaling: Health checks>
-- in the /Amazon EC2 Auto Scaling User Guide/. For more information, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html Elastic Load Balancing and Amazon EC2 Auto Scaling>
-- in the /Amazon EC2 Auto Scaling User Guide/.
--
-- This operation returns paginated results.
module Amazonka.AutoScaling.DescribeLoadBalancers
  ( -- * Creating a Request
    DescribeLoadBalancers (..),
    newDescribeLoadBalancers,

    -- * Request Lenses
    describeLoadBalancers_nextToken,
    describeLoadBalancers_maxRecords,
    describeLoadBalancers_autoScalingGroupName,

    -- * Destructuring the Response
    DescribeLoadBalancersResponse (..),
    newDescribeLoadBalancersResponse,

    -- * Response Lenses
    describeLoadBalancersResponse_loadBalancers,
    describeLoadBalancersResponse_nextToken,
    describeLoadBalancersResponse_httpStatus,
  )
where

import Amazonka.AutoScaling.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeLoadBalancers' smart constructor.
data DescribeLoadBalancers = DescribeLoadBalancers'
  { -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeLoadBalancers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call. The default value
    -- is @100@ and the maximum value is @100@.
    DescribeLoadBalancers -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | The name of the Auto Scaling group.
    DescribeLoadBalancers -> Text
autoScalingGroupName :: Prelude.Text
  }
  deriving (DescribeLoadBalancers -> DescribeLoadBalancers -> Bool
(DescribeLoadBalancers -> DescribeLoadBalancers -> Bool)
-> (DescribeLoadBalancers -> DescribeLoadBalancers -> Bool)
-> Eq DescribeLoadBalancers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLoadBalancers -> DescribeLoadBalancers -> Bool
$c/= :: DescribeLoadBalancers -> DescribeLoadBalancers -> Bool
== :: DescribeLoadBalancers -> DescribeLoadBalancers -> Bool
$c== :: DescribeLoadBalancers -> DescribeLoadBalancers -> Bool
Prelude.Eq, ReadPrec [DescribeLoadBalancers]
ReadPrec DescribeLoadBalancers
Int -> ReadS DescribeLoadBalancers
ReadS [DescribeLoadBalancers]
(Int -> ReadS DescribeLoadBalancers)
-> ReadS [DescribeLoadBalancers]
-> ReadPrec DescribeLoadBalancers
-> ReadPrec [DescribeLoadBalancers]
-> Read DescribeLoadBalancers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLoadBalancers]
$creadListPrec :: ReadPrec [DescribeLoadBalancers]
readPrec :: ReadPrec DescribeLoadBalancers
$creadPrec :: ReadPrec DescribeLoadBalancers
readList :: ReadS [DescribeLoadBalancers]
$creadList :: ReadS [DescribeLoadBalancers]
readsPrec :: Int -> ReadS DescribeLoadBalancers
$creadsPrec :: Int -> ReadS DescribeLoadBalancers
Prelude.Read, Int -> DescribeLoadBalancers -> ShowS
[DescribeLoadBalancers] -> ShowS
DescribeLoadBalancers -> String
(Int -> DescribeLoadBalancers -> ShowS)
-> (DescribeLoadBalancers -> String)
-> ([DescribeLoadBalancers] -> ShowS)
-> Show DescribeLoadBalancers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLoadBalancers] -> ShowS
$cshowList :: [DescribeLoadBalancers] -> ShowS
show :: DescribeLoadBalancers -> String
$cshow :: DescribeLoadBalancers -> String
showsPrec :: Int -> DescribeLoadBalancers -> ShowS
$cshowsPrec :: Int -> DescribeLoadBalancers -> ShowS
Prelude.Show, (forall x. DescribeLoadBalancers -> Rep DescribeLoadBalancers x)
-> (forall x. Rep DescribeLoadBalancers x -> DescribeLoadBalancers)
-> Generic DescribeLoadBalancers
forall x. Rep DescribeLoadBalancers x -> DescribeLoadBalancers
forall x. DescribeLoadBalancers -> Rep DescribeLoadBalancers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeLoadBalancers x -> DescribeLoadBalancers
$cfrom :: forall x. DescribeLoadBalancers -> Rep DescribeLoadBalancers x
Prelude.Generic)

-- |
-- Create a value of 'DescribeLoadBalancers' 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:
--
-- 'nextToken', 'describeLoadBalancers_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxRecords', 'describeLoadBalancers_maxRecords' - The maximum number of items to return with this call. The default value
-- is @100@ and the maximum value is @100@.
--
-- 'autoScalingGroupName', 'describeLoadBalancers_autoScalingGroupName' - The name of the Auto Scaling group.
newDescribeLoadBalancers ::
  -- | 'autoScalingGroupName'
  Prelude.Text ->
  DescribeLoadBalancers
newDescribeLoadBalancers :: Text -> DescribeLoadBalancers
newDescribeLoadBalancers Text
pAutoScalingGroupName_ =
  DescribeLoadBalancers' :: Maybe Text -> Maybe Int -> Text -> DescribeLoadBalancers
DescribeLoadBalancers'
    { $sel:nextToken:DescribeLoadBalancers' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeLoadBalancers' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingGroupName:DescribeLoadBalancers' :: Text
autoScalingGroupName = Text
pAutoScalingGroupName_
    }

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
describeLoadBalancers_nextToken :: Lens.Lens' DescribeLoadBalancers (Prelude.Maybe Prelude.Text)
describeLoadBalancers_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeLoadBalancers -> f DescribeLoadBalancers
describeLoadBalancers_nextToken = (DescribeLoadBalancers -> Maybe Text)
-> (DescribeLoadBalancers -> Maybe Text -> DescribeLoadBalancers)
-> Lens
     DescribeLoadBalancers
     DescribeLoadBalancers
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoadBalancers' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeLoadBalancers
s@DescribeLoadBalancers' {} Maybe Text
a -> DescribeLoadBalancers
s {$sel:nextToken:DescribeLoadBalancers' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeLoadBalancers)

-- | The maximum number of items to return with this call. The default value
-- is @100@ and the maximum value is @100@.
describeLoadBalancers_maxRecords :: Lens.Lens' DescribeLoadBalancers (Prelude.Maybe Prelude.Int)
describeLoadBalancers_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeLoadBalancers -> f DescribeLoadBalancers
describeLoadBalancers_maxRecords = (DescribeLoadBalancers -> Maybe Int)
-> (DescribeLoadBalancers -> Maybe Int -> DescribeLoadBalancers)
-> Lens
     DescribeLoadBalancers DescribeLoadBalancers (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoadBalancers' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeLoadBalancers
s@DescribeLoadBalancers' {} Maybe Int
a -> DescribeLoadBalancers
s {$sel:maxRecords:DescribeLoadBalancers' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeLoadBalancers)

-- | The name of the Auto Scaling group.
describeLoadBalancers_autoScalingGroupName :: Lens.Lens' DescribeLoadBalancers Prelude.Text
describeLoadBalancers_autoScalingGroupName :: (Text -> f Text)
-> DescribeLoadBalancers -> f DescribeLoadBalancers
describeLoadBalancers_autoScalingGroupName = (DescribeLoadBalancers -> Text)
-> (DescribeLoadBalancers -> Text -> DescribeLoadBalancers)
-> Lens DescribeLoadBalancers DescribeLoadBalancers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoadBalancers' {Text
autoScalingGroupName :: Text
$sel:autoScalingGroupName:DescribeLoadBalancers' :: DescribeLoadBalancers -> Text
autoScalingGroupName} -> Text
autoScalingGroupName) (\s :: DescribeLoadBalancers
s@DescribeLoadBalancers' {} Text
a -> DescribeLoadBalancers
s {$sel:autoScalingGroupName:DescribeLoadBalancers' :: Text
autoScalingGroupName = Text
a} :: DescribeLoadBalancers)

instance Core.AWSPager DescribeLoadBalancers where
  page :: DescribeLoadBalancers
-> AWSResponse DescribeLoadBalancers -> Maybe DescribeLoadBalancers
page DescribeLoadBalancers
rq AWSResponse DescribeLoadBalancers
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeLoadBalancers
DescribeLoadBalancersResponse
rs
            DescribeLoadBalancersResponse
-> Getting (First Text) DescribeLoadBalancersResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeLoadBalancersResponse
-> Const (First Text) DescribeLoadBalancersResponse
Lens' DescribeLoadBalancersResponse (Maybe Text)
describeLoadBalancersResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeLoadBalancersResponse
 -> Const (First Text) DescribeLoadBalancersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeLoadBalancersResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeLoadBalancers
forall a. Maybe a
Prelude.Nothing
    | Maybe [LoadBalancerState] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeLoadBalancers
DescribeLoadBalancersResponse
rs
            DescribeLoadBalancersResponse
-> Getting
     (First [LoadBalancerState])
     DescribeLoadBalancersResponse
     [LoadBalancerState]
-> Maybe [LoadBalancerState]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [LoadBalancerState]
 -> Const (First [LoadBalancerState]) (Maybe [LoadBalancerState]))
-> DescribeLoadBalancersResponse
-> Const (First [LoadBalancerState]) DescribeLoadBalancersResponse
Lens' DescribeLoadBalancersResponse (Maybe [LoadBalancerState])
describeLoadBalancersResponse_loadBalancers
              ((Maybe [LoadBalancerState]
  -> Const (First [LoadBalancerState]) (Maybe [LoadBalancerState]))
 -> DescribeLoadBalancersResponse
 -> Const (First [LoadBalancerState]) DescribeLoadBalancersResponse)
-> (([LoadBalancerState]
     -> Const (First [LoadBalancerState]) [LoadBalancerState])
    -> Maybe [LoadBalancerState]
    -> Const (First [LoadBalancerState]) (Maybe [LoadBalancerState]))
-> Getting
     (First [LoadBalancerState])
     DescribeLoadBalancersResponse
     [LoadBalancerState]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LoadBalancerState]
 -> Const (First [LoadBalancerState]) [LoadBalancerState])
-> Maybe [LoadBalancerState]
-> Const (First [LoadBalancerState]) (Maybe [LoadBalancerState])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeLoadBalancers
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeLoadBalancers -> Maybe DescribeLoadBalancers
forall a. a -> Maybe a
Prelude.Just (DescribeLoadBalancers -> Maybe DescribeLoadBalancers)
-> DescribeLoadBalancers -> Maybe DescribeLoadBalancers
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeLoadBalancers
rq
          DescribeLoadBalancers
-> (DescribeLoadBalancers -> DescribeLoadBalancers)
-> DescribeLoadBalancers
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeLoadBalancers -> Identity DescribeLoadBalancers
Lens
  DescribeLoadBalancers
  DescribeLoadBalancers
  (Maybe Text)
  (Maybe Text)
describeLoadBalancers_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeLoadBalancers -> Identity DescribeLoadBalancers)
-> Maybe Text -> DescribeLoadBalancers -> DescribeLoadBalancers
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeLoadBalancers
DescribeLoadBalancersResponse
rs
          DescribeLoadBalancersResponse
-> Getting (First Text) DescribeLoadBalancersResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeLoadBalancersResponse
-> Const (First Text) DescribeLoadBalancersResponse
Lens' DescribeLoadBalancersResponse (Maybe Text)
describeLoadBalancersResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeLoadBalancersResponse
 -> Const (First Text) DescribeLoadBalancersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeLoadBalancersResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeLoadBalancers where
  type
    AWSResponse DescribeLoadBalancers =
      DescribeLoadBalancersResponse
  request :: DescribeLoadBalancers -> Request DescribeLoadBalancers
request = Service -> DescribeLoadBalancers -> Request DescribeLoadBalancers
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeLoadBalancers
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLoadBalancers)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeLoadBalancers))
-> Logger
-> Service
-> Proxy DescribeLoadBalancers
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLoadBalancers)))
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
"DescribeLoadBalancersResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [LoadBalancerState]
-> Maybe Text -> Int -> DescribeLoadBalancersResponse
DescribeLoadBalancersResponse'
            (Maybe [LoadBalancerState]
 -> Maybe Text -> Int -> DescribeLoadBalancersResponse)
-> Either String (Maybe [LoadBalancerState])
-> Either
     String (Maybe Text -> Int -> DescribeLoadBalancersResponse)
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
"LoadBalancers" 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 [LoadBalancerState]))
-> Either String (Maybe [LoadBalancerState])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [LoadBalancerState])
-> [Node] -> Either String (Maybe [LoadBalancerState])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [LoadBalancerState]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Maybe Text -> Int -> DescribeLoadBalancersResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeLoadBalancersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
            Either String (Int -> DescribeLoadBalancersResponse)
-> Either String Int -> Either String DescribeLoadBalancersResponse
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 DescribeLoadBalancers

instance Prelude.NFData DescribeLoadBalancers

instance Core.ToHeaders DescribeLoadBalancers where
  toHeaders :: DescribeLoadBalancers -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeLoadBalancers -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DescribeLoadBalancers where
  toPath :: DescribeLoadBalancers -> ByteString
toPath = ByteString -> DescribeLoadBalancers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeLoadBalancers where
  toQuery :: DescribeLoadBalancers -> QueryString
toQuery DescribeLoadBalancers' {Maybe Int
Maybe Text
Text
autoScalingGroupName :: Text
maxRecords :: Maybe Int
nextToken :: Maybe Text
$sel:autoScalingGroupName:DescribeLoadBalancers' :: DescribeLoadBalancers -> Text
$sel:maxRecords:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe Int
$sel:nextToken:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeLoadBalancers" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-01-01" :: Prelude.ByteString),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords,
        ByteString
"AutoScalingGroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
autoScalingGroupName
      ]

-- | /See:/ 'newDescribeLoadBalancersResponse' smart constructor.
data DescribeLoadBalancersResponse = DescribeLoadBalancersResponse'
  { -- | The load balancers.
    DescribeLoadBalancersResponse -> Maybe [LoadBalancerState]
loadBalancers :: Prelude.Maybe [LoadBalancerState],
    -- | A string that indicates that the response contains more items than can
    -- be returned in a single response. To receive additional items, specify
    -- this string for the @NextToken@ value when requesting the next set of
    -- items. This value is null when there are no more items to return.
    DescribeLoadBalancersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeLoadBalancersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeLoadBalancersResponse
-> DescribeLoadBalancersResponse -> Bool
(DescribeLoadBalancersResponse
 -> DescribeLoadBalancersResponse -> Bool)
-> (DescribeLoadBalancersResponse
    -> DescribeLoadBalancersResponse -> Bool)
-> Eq DescribeLoadBalancersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLoadBalancersResponse
-> DescribeLoadBalancersResponse -> Bool
$c/= :: DescribeLoadBalancersResponse
-> DescribeLoadBalancersResponse -> Bool
== :: DescribeLoadBalancersResponse
-> DescribeLoadBalancersResponse -> Bool
$c== :: DescribeLoadBalancersResponse
-> DescribeLoadBalancersResponse -> Bool
Prelude.Eq, ReadPrec [DescribeLoadBalancersResponse]
ReadPrec DescribeLoadBalancersResponse
Int -> ReadS DescribeLoadBalancersResponse
ReadS [DescribeLoadBalancersResponse]
(Int -> ReadS DescribeLoadBalancersResponse)
-> ReadS [DescribeLoadBalancersResponse]
-> ReadPrec DescribeLoadBalancersResponse
-> ReadPrec [DescribeLoadBalancersResponse]
-> Read DescribeLoadBalancersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLoadBalancersResponse]
$creadListPrec :: ReadPrec [DescribeLoadBalancersResponse]
readPrec :: ReadPrec DescribeLoadBalancersResponse
$creadPrec :: ReadPrec DescribeLoadBalancersResponse
readList :: ReadS [DescribeLoadBalancersResponse]
$creadList :: ReadS [DescribeLoadBalancersResponse]
readsPrec :: Int -> ReadS DescribeLoadBalancersResponse
$creadsPrec :: Int -> ReadS DescribeLoadBalancersResponse
Prelude.Read, Int -> DescribeLoadBalancersResponse -> ShowS
[DescribeLoadBalancersResponse] -> ShowS
DescribeLoadBalancersResponse -> String
(Int -> DescribeLoadBalancersResponse -> ShowS)
-> (DescribeLoadBalancersResponse -> String)
-> ([DescribeLoadBalancersResponse] -> ShowS)
-> Show DescribeLoadBalancersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLoadBalancersResponse] -> ShowS
$cshowList :: [DescribeLoadBalancersResponse] -> ShowS
show :: DescribeLoadBalancersResponse -> String
$cshow :: DescribeLoadBalancersResponse -> String
showsPrec :: Int -> DescribeLoadBalancersResponse -> ShowS
$cshowsPrec :: Int -> DescribeLoadBalancersResponse -> ShowS
Prelude.Show, (forall x.
 DescribeLoadBalancersResponse
 -> Rep DescribeLoadBalancersResponse x)
-> (forall x.
    Rep DescribeLoadBalancersResponse x
    -> DescribeLoadBalancersResponse)
-> Generic DescribeLoadBalancersResponse
forall x.
Rep DescribeLoadBalancersResponse x
-> DescribeLoadBalancersResponse
forall x.
DescribeLoadBalancersResponse
-> Rep DescribeLoadBalancersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeLoadBalancersResponse x
-> DescribeLoadBalancersResponse
$cfrom :: forall x.
DescribeLoadBalancersResponse
-> Rep DescribeLoadBalancersResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeLoadBalancersResponse' 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:
--
-- 'loadBalancers', 'describeLoadBalancersResponse_loadBalancers' - The load balancers.
--
-- 'nextToken', 'describeLoadBalancersResponse_nextToken' - A string that indicates that the response contains more items than can
-- be returned in a single response. To receive additional items, specify
-- this string for the @NextToken@ value when requesting the next set of
-- items. This value is null when there are no more items to return.
--
-- 'httpStatus', 'describeLoadBalancersResponse_httpStatus' - The response's http status code.
newDescribeLoadBalancersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeLoadBalancersResponse
newDescribeLoadBalancersResponse :: Int -> DescribeLoadBalancersResponse
newDescribeLoadBalancersResponse Int
pHttpStatus_ =
  DescribeLoadBalancersResponse' :: Maybe [LoadBalancerState]
-> Maybe Text -> Int -> DescribeLoadBalancersResponse
DescribeLoadBalancersResponse'
    { $sel:loadBalancers:DescribeLoadBalancersResponse' :: Maybe [LoadBalancerState]
loadBalancers =
        Maybe [LoadBalancerState]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeLoadBalancersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeLoadBalancersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The load balancers.
describeLoadBalancersResponse_loadBalancers :: Lens.Lens' DescribeLoadBalancersResponse (Prelude.Maybe [LoadBalancerState])
describeLoadBalancersResponse_loadBalancers :: (Maybe [LoadBalancerState] -> f (Maybe [LoadBalancerState]))
-> DescribeLoadBalancersResponse -> f DescribeLoadBalancersResponse
describeLoadBalancersResponse_loadBalancers = (DescribeLoadBalancersResponse -> Maybe [LoadBalancerState])
-> (DescribeLoadBalancersResponse
    -> Maybe [LoadBalancerState] -> DescribeLoadBalancersResponse)
-> Lens' DescribeLoadBalancersResponse (Maybe [LoadBalancerState])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoadBalancersResponse' {Maybe [LoadBalancerState]
loadBalancers :: Maybe [LoadBalancerState]
$sel:loadBalancers:DescribeLoadBalancersResponse' :: DescribeLoadBalancersResponse -> Maybe [LoadBalancerState]
loadBalancers} -> Maybe [LoadBalancerState]
loadBalancers) (\s :: DescribeLoadBalancersResponse
s@DescribeLoadBalancersResponse' {} Maybe [LoadBalancerState]
a -> DescribeLoadBalancersResponse
s {$sel:loadBalancers:DescribeLoadBalancersResponse' :: Maybe [LoadBalancerState]
loadBalancers = Maybe [LoadBalancerState]
a} :: DescribeLoadBalancersResponse) ((Maybe [LoadBalancerState] -> f (Maybe [LoadBalancerState]))
 -> DescribeLoadBalancersResponse
 -> f DescribeLoadBalancersResponse)
-> ((Maybe [LoadBalancerState] -> f (Maybe [LoadBalancerState]))
    -> Maybe [LoadBalancerState] -> f (Maybe [LoadBalancerState]))
-> (Maybe [LoadBalancerState] -> f (Maybe [LoadBalancerState]))
-> DescribeLoadBalancersResponse
-> f DescribeLoadBalancersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LoadBalancerState]
  [LoadBalancerState]
  [LoadBalancerState]
  [LoadBalancerState]
-> Iso
     (Maybe [LoadBalancerState])
     (Maybe [LoadBalancerState])
     (Maybe [LoadBalancerState])
     (Maybe [LoadBalancerState])
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
  [LoadBalancerState]
  [LoadBalancerState]
  [LoadBalancerState]
  [LoadBalancerState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A string that indicates that the response contains more items than can
-- be returned in a single response. To receive additional items, specify
-- this string for the @NextToken@ value when requesting the next set of
-- items. This value is null when there are no more items to return.
describeLoadBalancersResponse_nextToken :: Lens.Lens' DescribeLoadBalancersResponse (Prelude.Maybe Prelude.Text)
describeLoadBalancersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeLoadBalancersResponse -> f DescribeLoadBalancersResponse
describeLoadBalancersResponse_nextToken = (DescribeLoadBalancersResponse -> Maybe Text)
-> (DescribeLoadBalancersResponse
    -> Maybe Text -> DescribeLoadBalancersResponse)
-> Lens' DescribeLoadBalancersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoadBalancersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeLoadBalancersResponse' :: DescribeLoadBalancersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeLoadBalancersResponse
s@DescribeLoadBalancersResponse' {} Maybe Text
a -> DescribeLoadBalancersResponse
s {$sel:nextToken:DescribeLoadBalancersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeLoadBalancersResponse)

-- | The response's http status code.
describeLoadBalancersResponse_httpStatus :: Lens.Lens' DescribeLoadBalancersResponse Prelude.Int
describeLoadBalancersResponse_httpStatus :: (Int -> f Int)
-> DescribeLoadBalancersResponse -> f DescribeLoadBalancersResponse
describeLoadBalancersResponse_httpStatus = (DescribeLoadBalancersResponse -> Int)
-> (DescribeLoadBalancersResponse
    -> Int -> DescribeLoadBalancersResponse)
-> Lens
     DescribeLoadBalancersResponse DescribeLoadBalancersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoadBalancersResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeLoadBalancersResponse' :: DescribeLoadBalancersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeLoadBalancersResponse
s@DescribeLoadBalancersResponse' {} Int
a -> DescribeLoadBalancersResponse
s {$sel:httpStatus:DescribeLoadBalancersResponse' :: Int
httpStatus = Int
a} :: DescribeLoadBalancersResponse)

instance Prelude.NFData DescribeLoadBalancersResponse