{-# 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.ELBV2.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)
--
-- Describes the specified load balancers or all of your load balancers.
--
-- This operation returns paginated results.
module Amazonka.ELBV2.DescribeLoadBalancers
  ( -- * Creating a Request
    DescribeLoadBalancers (..),
    newDescribeLoadBalancers,

    -- * Request Lenses
    describeLoadBalancers_names,
    describeLoadBalancers_loadBalancerArns,
    describeLoadBalancers_marker,
    describeLoadBalancers_pageSize,

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

    -- * Response Lenses
    describeLoadBalancersResponse_loadBalancers,
    describeLoadBalancersResponse_nextMarker,
    describeLoadBalancersResponse_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

-- | /See:/ 'newDescribeLoadBalancers' smart constructor.
data DescribeLoadBalancers = DescribeLoadBalancers'
  { -- | The names of the load balancers.
    DescribeLoadBalancers -> Maybe [Text]
names :: Prelude.Maybe [Prelude.Text],
    -- | The Amazon Resource Names (ARN) of the load balancers. You can specify
    -- up to 20 load balancers in a single call.
    DescribeLoadBalancers -> Maybe [Text]
loadBalancerArns :: Prelude.Maybe [Prelude.Text],
    -- | The marker for the next set of results. (You received this marker from a
    -- previous call.)
    DescribeLoadBalancers -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return with this call.
    DescribeLoadBalancers -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural
  }
  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:
--
-- 'names', 'describeLoadBalancers_names' - The names of the load balancers.
--
-- 'loadBalancerArns', 'describeLoadBalancers_loadBalancerArns' - The Amazon Resource Names (ARN) of the load balancers. You can specify
-- up to 20 load balancers in a single call.
--
-- 'marker', 'describeLoadBalancers_marker' - The marker for the next set of results. (You received this marker from a
-- previous call.)
--
-- 'pageSize', 'describeLoadBalancers_pageSize' - The maximum number of results to return with this call.
newDescribeLoadBalancers ::
  DescribeLoadBalancers
newDescribeLoadBalancers :: DescribeLoadBalancers
newDescribeLoadBalancers =
  DescribeLoadBalancers' :: Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe Natural
-> DescribeLoadBalancers
DescribeLoadBalancers'
    { $sel:names:DescribeLoadBalancers' :: Maybe [Text]
names = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:loadBalancerArns:DescribeLoadBalancers' :: Maybe [Text]
loadBalancerArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeLoadBalancers' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:DescribeLoadBalancers' :: Maybe Natural
pageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The names of the load balancers.
describeLoadBalancers_names :: Lens.Lens' DescribeLoadBalancers (Prelude.Maybe [Prelude.Text])
describeLoadBalancers_names :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeLoadBalancers -> f DescribeLoadBalancers
describeLoadBalancers_names = (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]
names :: Maybe [Text]
$sel:names:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe [Text]
names} -> Maybe [Text]
names) (\s :: DescribeLoadBalancers
s@DescribeLoadBalancers' {} Maybe [Text]
a -> DescribeLoadBalancers
s {$sel:names:DescribeLoadBalancers' :: Maybe [Text]
names = Maybe [Text]
a} :: DescribeLoadBalancers) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeLoadBalancers -> f DescribeLoadBalancers)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeLoadBalancers
-> f DescribeLoadBalancers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Names (ARN) of the load balancers. You can specify
-- up to 20 load balancers in a single call.
describeLoadBalancers_loadBalancerArns :: Lens.Lens' DescribeLoadBalancers (Prelude.Maybe [Prelude.Text])
describeLoadBalancers_loadBalancerArns :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeLoadBalancers -> f DescribeLoadBalancers
describeLoadBalancers_loadBalancerArns = (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]
loadBalancerArns :: Maybe [Text]
$sel:loadBalancerArns:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe [Text]
loadBalancerArns} -> Maybe [Text]
loadBalancerArns) (\s :: DescribeLoadBalancers
s@DescribeLoadBalancers' {} Maybe [Text]
a -> DescribeLoadBalancers
s {$sel:loadBalancerArns:DescribeLoadBalancers' :: Maybe [Text]
loadBalancerArns = Maybe [Text]
a} :: DescribeLoadBalancers) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeLoadBalancers -> f DescribeLoadBalancers)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeLoadBalancers
-> f DescribeLoadBalancers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The marker for the next set of results. (You received this marker from a
-- previous call.)
describeLoadBalancers_marker :: Lens.Lens' DescribeLoadBalancers (Prelude.Maybe Prelude.Text)
describeLoadBalancers_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeLoadBalancers -> f DescribeLoadBalancers
describeLoadBalancers_marker = (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
marker :: Maybe Text
$sel:marker:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeLoadBalancers
s@DescribeLoadBalancers' {} Maybe Text
a -> DescribeLoadBalancers
s {$sel:marker:DescribeLoadBalancers' :: Maybe Text
marker = Maybe Text
a} :: DescribeLoadBalancers)

-- | The maximum number of results to return with this call.
describeLoadBalancers_pageSize :: Lens.Lens' DescribeLoadBalancers (Prelude.Maybe Prelude.Natural)
describeLoadBalancers_pageSize :: (Maybe Natural -> f (Maybe Natural))
-> DescribeLoadBalancers -> f DescribeLoadBalancers
describeLoadBalancers_pageSize = (DescribeLoadBalancers -> Maybe Natural)
-> (DescribeLoadBalancers
    -> Maybe Natural -> DescribeLoadBalancers)
-> Lens
     DescribeLoadBalancers
     DescribeLoadBalancers
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoadBalancers' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: DescribeLoadBalancers
s@DescribeLoadBalancers' {} Maybe Natural
a -> DescribeLoadBalancers
s {$sel:pageSize:DescribeLoadBalancers' :: Maybe Natural
pageSize = Maybe Natural
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_nextMarker
              ((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 [LoadBalancer] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeLoadBalancers
DescribeLoadBalancersResponse
rs
            DescribeLoadBalancersResponse
-> Getting
     (First [LoadBalancer]) DescribeLoadBalancersResponse [LoadBalancer]
-> Maybe [LoadBalancer]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [LoadBalancer]
 -> Const (First [LoadBalancer]) (Maybe [LoadBalancer]))
-> DescribeLoadBalancersResponse
-> Const (First [LoadBalancer]) DescribeLoadBalancersResponse
Lens' DescribeLoadBalancersResponse (Maybe [LoadBalancer])
describeLoadBalancersResponse_loadBalancers
              ((Maybe [LoadBalancer]
  -> Const (First [LoadBalancer]) (Maybe [LoadBalancer]))
 -> DescribeLoadBalancersResponse
 -> Const (First [LoadBalancer]) DescribeLoadBalancersResponse)
-> (([LoadBalancer] -> Const (First [LoadBalancer]) [LoadBalancer])
    -> Maybe [LoadBalancer]
    -> Const (First [LoadBalancer]) (Maybe [LoadBalancer]))
-> Getting
     (First [LoadBalancer]) DescribeLoadBalancersResponse [LoadBalancer]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LoadBalancer] -> Const (First [LoadBalancer]) [LoadBalancer])
-> Maybe [LoadBalancer]
-> Const (First [LoadBalancer]) (Maybe [LoadBalancer])
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_marker
          ((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_nextMarker
            ((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 [LoadBalancer]
-> Maybe Text -> Int -> DescribeLoadBalancersResponse
DescribeLoadBalancersResponse'
            (Maybe [LoadBalancer]
 -> Maybe Text -> Int -> DescribeLoadBalancersResponse)
-> Either String (Maybe [LoadBalancer])
-> 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 [LoadBalancer]))
-> Either String (Maybe [LoadBalancer])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [LoadBalancer])
-> [Node] -> Either String (Maybe [LoadBalancer])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [LoadBalancer]
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
"NextMarker")
            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 Natural
Maybe [Text]
Maybe Text
pageSize :: Maybe Natural
marker :: Maybe Text
loadBalancerArns :: Maybe [Text]
names :: Maybe [Text]
$sel:pageSize:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe Natural
$sel:marker:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe Text
$sel:loadBalancerArns:DescribeLoadBalancers' :: DescribeLoadBalancers -> Maybe [Text]
$sel:names: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
"2015-12-01" :: Prelude.ByteString),
        ByteString
"Names"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
names),
        ByteString
"LoadBalancerArns"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
loadBalancerArns
            ),
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"PageSize" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
pageSize
      ]

-- | /See:/ 'newDescribeLoadBalancersResponse' smart constructor.
data DescribeLoadBalancersResponse = DescribeLoadBalancersResponse'
  { -- | Information about the load balancers.
    DescribeLoadBalancersResponse -> Maybe [LoadBalancer]
loadBalancers :: Prelude.Maybe [LoadBalancer],
    -- | If there are additional results, this is the marker for the next set of
    -- results. Otherwise, this is null.
    DescribeLoadBalancersResponse -> Maybe Text
nextMarker :: 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' - Information about the load balancers.
--
-- 'nextMarker', 'describeLoadBalancersResponse_nextMarker' - If there are additional results, this is the marker for the next set of
-- results. Otherwise, this is null.
--
-- 'httpStatus', 'describeLoadBalancersResponse_httpStatus' - The response's http status code.
newDescribeLoadBalancersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeLoadBalancersResponse
newDescribeLoadBalancersResponse :: Int -> DescribeLoadBalancersResponse
newDescribeLoadBalancersResponse Int
pHttpStatus_ =
  DescribeLoadBalancersResponse' :: Maybe [LoadBalancer]
-> Maybe Text -> Int -> DescribeLoadBalancersResponse
DescribeLoadBalancersResponse'
    { $sel:loadBalancers:DescribeLoadBalancersResponse' :: Maybe [LoadBalancer]
loadBalancers =
        Maybe [LoadBalancer]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:DescribeLoadBalancersResponse' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeLoadBalancersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | If there are additional results, this is the marker for the next set of
-- results. Otherwise, this is null.
describeLoadBalancersResponse_nextMarker :: Lens.Lens' DescribeLoadBalancersResponse (Prelude.Maybe Prelude.Text)
describeLoadBalancersResponse_nextMarker :: (Maybe Text -> f (Maybe Text))
-> DescribeLoadBalancersResponse -> f DescribeLoadBalancersResponse
describeLoadBalancersResponse_nextMarker = (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
nextMarker :: Maybe Text
$sel:nextMarker:DescribeLoadBalancersResponse' :: DescribeLoadBalancersResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: DescribeLoadBalancersResponse
s@DescribeLoadBalancersResponse' {} Maybe Text
a -> DescribeLoadBalancersResponse
s {$sel:nextMarker:DescribeLoadBalancersResponse' :: Maybe Text
nextMarker = 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