{-# 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.ELB.DescribeAccountLimits
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the current Elastic Load Balancing resource limits for your
-- AWS account.
--
-- For more information, see
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-limits.html Limits for Your Classic Load Balancer>
-- in the /Classic Load Balancers Guide/.
--
-- This operation returns paginated results.
module Amazonka.ELB.DescribeAccountLimits
  ( -- * Creating a Request
    DescribeAccountLimits (..),
    newDescribeAccountLimits,

    -- * Request Lenses
    describeAccountLimits_marker,
    describeAccountLimits_pageSize,

    -- * Destructuring the Response
    DescribeAccountLimitsResponse (..),
    newDescribeAccountLimitsResponse,

    -- * Response Lenses
    describeAccountLimitsResponse_limits,
    describeAccountLimitsResponse_nextMarker,
    describeAccountLimitsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ELB.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeAccountLimits' smart constructor.
data DescribeAccountLimits = DescribeAccountLimits'
  { -- | The marker for the next set of results. (You received this marker from a
    -- previous call.)
    DescribeAccountLimits -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return with this call.
    DescribeAccountLimits -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeAccountLimits -> DescribeAccountLimits -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountLimits -> DescribeAccountLimits -> Bool
$c/= :: DescribeAccountLimits -> DescribeAccountLimits -> Bool
== :: DescribeAccountLimits -> DescribeAccountLimits -> Bool
$c== :: DescribeAccountLimits -> DescribeAccountLimits -> Bool
Prelude.Eq, ReadPrec [DescribeAccountLimits]
ReadPrec DescribeAccountLimits
Int -> ReadS DescribeAccountLimits
ReadS [DescribeAccountLimits]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountLimits]
$creadListPrec :: ReadPrec [DescribeAccountLimits]
readPrec :: ReadPrec DescribeAccountLimits
$creadPrec :: ReadPrec DescribeAccountLimits
readList :: ReadS [DescribeAccountLimits]
$creadList :: ReadS [DescribeAccountLimits]
readsPrec :: Int -> ReadS DescribeAccountLimits
$creadsPrec :: Int -> ReadS DescribeAccountLimits
Prelude.Read, Int -> DescribeAccountLimits -> ShowS
[DescribeAccountLimits] -> ShowS
DescribeAccountLimits -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountLimits] -> ShowS
$cshowList :: [DescribeAccountLimits] -> ShowS
show :: DescribeAccountLimits -> String
$cshow :: DescribeAccountLimits -> String
showsPrec :: Int -> DescribeAccountLimits -> ShowS
$cshowsPrec :: Int -> DescribeAccountLimits -> ShowS
Prelude.Show, forall x. Rep DescribeAccountLimits x -> DescribeAccountLimits
forall x. DescribeAccountLimits -> Rep DescribeAccountLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAccountLimits x -> DescribeAccountLimits
$cfrom :: forall x. DescribeAccountLimits -> Rep DescribeAccountLimits x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccountLimits' 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:
--
-- 'marker', 'describeAccountLimits_marker' - The marker for the next set of results. (You received this marker from a
-- previous call.)
--
-- 'pageSize', 'describeAccountLimits_pageSize' - The maximum number of results to return with this call.
newDescribeAccountLimits ::
  DescribeAccountLimits
newDescribeAccountLimits :: DescribeAccountLimits
newDescribeAccountLimits =
  DescribeAccountLimits'
    { $sel:marker:DescribeAccountLimits' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:DescribeAccountLimits' :: Maybe Natural
pageSize = forall a. Maybe a
Prelude.Nothing
    }

-- | The marker for the next set of results. (You received this marker from a
-- previous call.)
describeAccountLimits_marker :: Lens.Lens' DescribeAccountLimits (Prelude.Maybe Prelude.Text)
describeAccountLimits_marker :: Lens' DescribeAccountLimits (Maybe Text)
describeAccountLimits_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountLimits' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeAccountLimits' :: DescribeAccountLimits -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeAccountLimits
s@DescribeAccountLimits' {} Maybe Text
a -> DescribeAccountLimits
s {$sel:marker:DescribeAccountLimits' :: Maybe Text
marker = Maybe Text
a} :: DescribeAccountLimits)

-- | The maximum number of results to return with this call.
describeAccountLimits_pageSize :: Lens.Lens' DescribeAccountLimits (Prelude.Maybe Prelude.Natural)
describeAccountLimits_pageSize :: Lens' DescribeAccountLimits (Maybe Natural)
describeAccountLimits_pageSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountLimits' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:DescribeAccountLimits' :: DescribeAccountLimits -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: DescribeAccountLimits
s@DescribeAccountLimits' {} Maybe Natural
a -> DescribeAccountLimits
s {$sel:pageSize:DescribeAccountLimits' :: Maybe Natural
pageSize = Maybe Natural
a} :: DescribeAccountLimits)

instance Core.AWSPager DescribeAccountLimits where
  page :: DescribeAccountLimits
-> AWSResponse DescribeAccountLimits -> Maybe DescribeAccountLimits
page DescribeAccountLimits
rq AWSResponse DescribeAccountLimits
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAccountLimits
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAccountLimitsResponse (Maybe Text)
describeAccountLimitsResponse_nextMarker
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeAccountLimits
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAccountLimitsResponse (Maybe [Limit])
describeAccountLimitsResponse_limits
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeAccountLimits
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeAccountLimits (Maybe Text)
describeAccountLimits_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeAccountLimits
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeAccountLimitsResponse (Maybe Text)
describeAccountLimitsResponse_nextMarker
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeAccountLimits where
  type
    AWSResponse DescribeAccountLimits =
      DescribeAccountLimitsResponse
  request :: (Service -> Service)
-> DescribeAccountLimits -> Request DescribeAccountLimits
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeAccountLimits
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAccountLimits)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeAccountLimitsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [Limit] -> Maybe Text -> Int -> DescribeAccountLimitsResponse
DescribeAccountLimitsResponse'
            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
"Limits"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            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
"NextMarker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeAccountLimits where
  hashWithSalt :: Int -> DescribeAccountLimits -> Int
hashWithSalt Int
_salt DescribeAccountLimits' {Maybe Natural
Maybe Text
pageSize :: Maybe Natural
marker :: Maybe Text
$sel:pageSize:DescribeAccountLimits' :: DescribeAccountLimits -> Maybe Natural
$sel:marker:DescribeAccountLimits' :: DescribeAccountLimits -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
pageSize

instance Prelude.NFData DescribeAccountLimits where
  rnf :: DescribeAccountLimits -> ()
rnf DescribeAccountLimits' {Maybe Natural
Maybe Text
pageSize :: Maybe Natural
marker :: Maybe Text
$sel:pageSize:DescribeAccountLimits' :: DescribeAccountLimits -> Maybe Natural
$sel:marker:DescribeAccountLimits' :: DescribeAccountLimits -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pageSize

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

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

instance Data.ToQuery DescribeAccountLimits where
  toQuery :: DescribeAccountLimits -> QueryString
toQuery DescribeAccountLimits' {Maybe Natural
Maybe Text
pageSize :: Maybe Natural
marker :: Maybe Text
$sel:pageSize:DescribeAccountLimits' :: DescribeAccountLimits -> Maybe Natural
$sel:marker:DescribeAccountLimits' :: DescribeAccountLimits -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeAccountLimits" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2012-06-01" :: Prelude.ByteString),
        ByteString
"Marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
        ByteString
"PageSize" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
pageSize
      ]

-- | /See:/ 'newDescribeAccountLimitsResponse' smart constructor.
data DescribeAccountLimitsResponse = DescribeAccountLimitsResponse'
  { -- | Information about the limits.
    DescribeAccountLimitsResponse -> Maybe [Limit]
limits :: Prelude.Maybe [Limit],
    -- | The marker to use when requesting the next set of results. If there are
    -- no additional results, the string is empty.
    DescribeAccountLimitsResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeAccountLimitsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAccountLimitsResponse
-> DescribeAccountLimitsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountLimitsResponse
-> DescribeAccountLimitsResponse -> Bool
$c/= :: DescribeAccountLimitsResponse
-> DescribeAccountLimitsResponse -> Bool
== :: DescribeAccountLimitsResponse
-> DescribeAccountLimitsResponse -> Bool
$c== :: DescribeAccountLimitsResponse
-> DescribeAccountLimitsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAccountLimitsResponse]
ReadPrec DescribeAccountLimitsResponse
Int -> ReadS DescribeAccountLimitsResponse
ReadS [DescribeAccountLimitsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountLimitsResponse]
$creadListPrec :: ReadPrec [DescribeAccountLimitsResponse]
readPrec :: ReadPrec DescribeAccountLimitsResponse
$creadPrec :: ReadPrec DescribeAccountLimitsResponse
readList :: ReadS [DescribeAccountLimitsResponse]
$creadList :: ReadS [DescribeAccountLimitsResponse]
readsPrec :: Int -> ReadS DescribeAccountLimitsResponse
$creadsPrec :: Int -> ReadS DescribeAccountLimitsResponse
Prelude.Read, Int -> DescribeAccountLimitsResponse -> ShowS
[DescribeAccountLimitsResponse] -> ShowS
DescribeAccountLimitsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountLimitsResponse] -> ShowS
$cshowList :: [DescribeAccountLimitsResponse] -> ShowS
show :: DescribeAccountLimitsResponse -> String
$cshow :: DescribeAccountLimitsResponse -> String
showsPrec :: Int -> DescribeAccountLimitsResponse -> ShowS
$cshowsPrec :: Int -> DescribeAccountLimitsResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeAccountLimitsResponse x
-> DescribeAccountLimitsResponse
forall x.
DescribeAccountLimitsResponse
-> Rep DescribeAccountLimitsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAccountLimitsResponse x
-> DescribeAccountLimitsResponse
$cfrom :: forall x.
DescribeAccountLimitsResponse
-> Rep DescribeAccountLimitsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccountLimitsResponse' 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:
--
-- 'limits', 'describeAccountLimitsResponse_limits' - Information about the limits.
--
-- 'nextMarker', 'describeAccountLimitsResponse_nextMarker' - The marker to use when requesting the next set of results. If there are
-- no additional results, the string is empty.
--
-- 'httpStatus', 'describeAccountLimitsResponse_httpStatus' - The response's http status code.
newDescribeAccountLimitsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAccountLimitsResponse
newDescribeAccountLimitsResponse :: Int -> DescribeAccountLimitsResponse
newDescribeAccountLimitsResponse Int
pHttpStatus_ =
  DescribeAccountLimitsResponse'
    { $sel:limits:DescribeAccountLimitsResponse' :: Maybe [Limit]
limits =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:DescribeAccountLimitsResponse' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAccountLimitsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the limits.
describeAccountLimitsResponse_limits :: Lens.Lens' DescribeAccountLimitsResponse (Prelude.Maybe [Limit])
describeAccountLimitsResponse_limits :: Lens' DescribeAccountLimitsResponse (Maybe [Limit])
describeAccountLimitsResponse_limits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountLimitsResponse' {Maybe [Limit]
limits :: Maybe [Limit]
$sel:limits:DescribeAccountLimitsResponse' :: DescribeAccountLimitsResponse -> Maybe [Limit]
limits} -> Maybe [Limit]
limits) (\s :: DescribeAccountLimitsResponse
s@DescribeAccountLimitsResponse' {} Maybe [Limit]
a -> DescribeAccountLimitsResponse
s {$sel:limits:DescribeAccountLimitsResponse' :: Maybe [Limit]
limits = Maybe [Limit]
a} :: DescribeAccountLimitsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The marker to use when requesting the next set of results. If there are
-- no additional results, the string is empty.
describeAccountLimitsResponse_nextMarker :: Lens.Lens' DescribeAccountLimitsResponse (Prelude.Maybe Prelude.Text)
describeAccountLimitsResponse_nextMarker :: Lens' DescribeAccountLimitsResponse (Maybe Text)
describeAccountLimitsResponse_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountLimitsResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:DescribeAccountLimitsResponse' :: DescribeAccountLimitsResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: DescribeAccountLimitsResponse
s@DescribeAccountLimitsResponse' {} Maybe Text
a -> DescribeAccountLimitsResponse
s {$sel:nextMarker:DescribeAccountLimitsResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: DescribeAccountLimitsResponse)

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

instance Prelude.NFData DescribeAccountLimitsResponse where
  rnf :: DescribeAccountLimitsResponse -> ()
rnf DescribeAccountLimitsResponse' {Int
Maybe [Limit]
Maybe Text
httpStatus :: Int
nextMarker :: Maybe Text
limits :: Maybe [Limit]
$sel:httpStatus:DescribeAccountLimitsResponse' :: DescribeAccountLimitsResponse -> Int
$sel:nextMarker:DescribeAccountLimitsResponse' :: DescribeAccountLimitsResponse -> Maybe Text
$sel:limits:DescribeAccountLimitsResponse' :: DescribeAccountLimitsResponse -> Maybe [Limit]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Limit]
limits
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus