{-# 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.ElasticBeanstalk.DescribeAccountAttributes
-- 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)
--
-- Returns attributes related to AWS Elastic Beanstalk that are associated
-- with the calling AWS account.
--
-- The result currently has one set of attributes—resource quotas.
module Amazonka.ElasticBeanstalk.DescribeAccountAttributes
  ( -- * Creating a Request
    DescribeAccountAttributes (..),
    newDescribeAccountAttributes,

    -- * Destructuring the Response
    DescribeAccountAttributesResponse (..),
    newDescribeAccountAttributesResponse,

    -- * Response Lenses
    describeAccountAttributesResponse_resourceQuotas,
    describeAccountAttributesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElasticBeanstalk.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:/ 'newDescribeAccountAttributes' smart constructor.
data DescribeAccountAttributes = DescribeAccountAttributes'
  {
  }
  deriving (DescribeAccountAttributes -> DescribeAccountAttributes -> Bool
(DescribeAccountAttributes -> DescribeAccountAttributes -> Bool)
-> (DescribeAccountAttributes -> DescribeAccountAttributes -> Bool)
-> Eq DescribeAccountAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountAttributes -> DescribeAccountAttributes -> Bool
$c/= :: DescribeAccountAttributes -> DescribeAccountAttributes -> Bool
== :: DescribeAccountAttributes -> DescribeAccountAttributes -> Bool
$c== :: DescribeAccountAttributes -> DescribeAccountAttributes -> Bool
Prelude.Eq, ReadPrec [DescribeAccountAttributes]
ReadPrec DescribeAccountAttributes
Int -> ReadS DescribeAccountAttributes
ReadS [DescribeAccountAttributes]
(Int -> ReadS DescribeAccountAttributes)
-> ReadS [DescribeAccountAttributes]
-> ReadPrec DescribeAccountAttributes
-> ReadPrec [DescribeAccountAttributes]
-> Read DescribeAccountAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountAttributes]
$creadListPrec :: ReadPrec [DescribeAccountAttributes]
readPrec :: ReadPrec DescribeAccountAttributes
$creadPrec :: ReadPrec DescribeAccountAttributes
readList :: ReadS [DescribeAccountAttributes]
$creadList :: ReadS [DescribeAccountAttributes]
readsPrec :: Int -> ReadS DescribeAccountAttributes
$creadsPrec :: Int -> ReadS DescribeAccountAttributes
Prelude.Read, Int -> DescribeAccountAttributes -> ShowS
[DescribeAccountAttributes] -> ShowS
DescribeAccountAttributes -> String
(Int -> DescribeAccountAttributes -> ShowS)
-> (DescribeAccountAttributes -> String)
-> ([DescribeAccountAttributes] -> ShowS)
-> Show DescribeAccountAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountAttributes] -> ShowS
$cshowList :: [DescribeAccountAttributes] -> ShowS
show :: DescribeAccountAttributes -> String
$cshow :: DescribeAccountAttributes -> String
showsPrec :: Int -> DescribeAccountAttributes -> ShowS
$cshowsPrec :: Int -> DescribeAccountAttributes -> ShowS
Prelude.Show, (forall x.
 DescribeAccountAttributes -> Rep DescribeAccountAttributes x)
-> (forall x.
    Rep DescribeAccountAttributes x -> DescribeAccountAttributes)
-> Generic DescribeAccountAttributes
forall x.
Rep DescribeAccountAttributes x -> DescribeAccountAttributes
forall x.
DescribeAccountAttributes -> Rep DescribeAccountAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAccountAttributes x -> DescribeAccountAttributes
$cfrom :: forall x.
DescribeAccountAttributes -> Rep DescribeAccountAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccountAttributes' 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.
newDescribeAccountAttributes ::
  DescribeAccountAttributes
newDescribeAccountAttributes :: DescribeAccountAttributes
newDescribeAccountAttributes =
  DescribeAccountAttributes
DescribeAccountAttributes'

instance Core.AWSRequest DescribeAccountAttributes where
  type
    AWSResponse DescribeAccountAttributes =
      DescribeAccountAttributesResponse
  request :: DescribeAccountAttributes -> Request DescribeAccountAttributes
request = Service
-> DescribeAccountAttributes -> Request DescribeAccountAttributes
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAccountAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAccountAttributes)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeAccountAttributes))
-> Logger
-> Service
-> Proxy DescribeAccountAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAccountAttributes)))
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
"DescribeAccountAttributesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe ResourceQuotas -> Int -> DescribeAccountAttributesResponse
DescribeAccountAttributesResponse'
            (Maybe ResourceQuotas -> Int -> DescribeAccountAttributesResponse)
-> Either String (Maybe ResourceQuotas)
-> Either String (Int -> DescribeAccountAttributesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ResourceQuotas)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ResourceQuotas")
            Either String (Int -> DescribeAccountAttributesResponse)
-> Either String Int
-> Either String DescribeAccountAttributesResponse
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 DescribeAccountAttributes

instance Prelude.NFData DescribeAccountAttributes

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

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

instance Core.ToQuery DescribeAccountAttributes where
  toQuery :: DescribeAccountAttributes -> QueryString
toQuery =
    QueryString -> DescribeAccountAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const
      ( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ ByteString
"Action"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeAccountAttributes" :: Prelude.ByteString),
            ByteString
"Version"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString)
          ]
      )

-- | /See:/ 'newDescribeAccountAttributesResponse' smart constructor.
data DescribeAccountAttributesResponse = DescribeAccountAttributesResponse'
  { -- | The Elastic Beanstalk resource quotas associated with the calling AWS
    -- account.
    DescribeAccountAttributesResponse -> Maybe ResourceQuotas
resourceQuotas :: Prelude.Maybe ResourceQuotas,
    -- | The response's http status code.
    DescribeAccountAttributesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAccountAttributesResponse
-> DescribeAccountAttributesResponse -> Bool
(DescribeAccountAttributesResponse
 -> DescribeAccountAttributesResponse -> Bool)
-> (DescribeAccountAttributesResponse
    -> DescribeAccountAttributesResponse -> Bool)
-> Eq DescribeAccountAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountAttributesResponse
-> DescribeAccountAttributesResponse -> Bool
$c/= :: DescribeAccountAttributesResponse
-> DescribeAccountAttributesResponse -> Bool
== :: DescribeAccountAttributesResponse
-> DescribeAccountAttributesResponse -> Bool
$c== :: DescribeAccountAttributesResponse
-> DescribeAccountAttributesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAccountAttributesResponse]
ReadPrec DescribeAccountAttributesResponse
Int -> ReadS DescribeAccountAttributesResponse
ReadS [DescribeAccountAttributesResponse]
(Int -> ReadS DescribeAccountAttributesResponse)
-> ReadS [DescribeAccountAttributesResponse]
-> ReadPrec DescribeAccountAttributesResponse
-> ReadPrec [DescribeAccountAttributesResponse]
-> Read DescribeAccountAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountAttributesResponse]
$creadListPrec :: ReadPrec [DescribeAccountAttributesResponse]
readPrec :: ReadPrec DescribeAccountAttributesResponse
$creadPrec :: ReadPrec DescribeAccountAttributesResponse
readList :: ReadS [DescribeAccountAttributesResponse]
$creadList :: ReadS [DescribeAccountAttributesResponse]
readsPrec :: Int -> ReadS DescribeAccountAttributesResponse
$creadsPrec :: Int -> ReadS DescribeAccountAttributesResponse
Prelude.Read, Int -> DescribeAccountAttributesResponse -> ShowS
[DescribeAccountAttributesResponse] -> ShowS
DescribeAccountAttributesResponse -> String
(Int -> DescribeAccountAttributesResponse -> ShowS)
-> (DescribeAccountAttributesResponse -> String)
-> ([DescribeAccountAttributesResponse] -> ShowS)
-> Show DescribeAccountAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountAttributesResponse] -> ShowS
$cshowList :: [DescribeAccountAttributesResponse] -> ShowS
show :: DescribeAccountAttributesResponse -> String
$cshow :: DescribeAccountAttributesResponse -> String
showsPrec :: Int -> DescribeAccountAttributesResponse -> ShowS
$cshowsPrec :: Int -> DescribeAccountAttributesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAccountAttributesResponse
 -> Rep DescribeAccountAttributesResponse x)
-> (forall x.
    Rep DescribeAccountAttributesResponse x
    -> DescribeAccountAttributesResponse)
-> Generic DescribeAccountAttributesResponse
forall x.
Rep DescribeAccountAttributesResponse x
-> DescribeAccountAttributesResponse
forall x.
DescribeAccountAttributesResponse
-> Rep DescribeAccountAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAccountAttributesResponse x
-> DescribeAccountAttributesResponse
$cfrom :: forall x.
DescribeAccountAttributesResponse
-> Rep DescribeAccountAttributesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccountAttributesResponse' 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:
--
-- 'resourceQuotas', 'describeAccountAttributesResponse_resourceQuotas' - The Elastic Beanstalk resource quotas associated with the calling AWS
-- account.
--
-- 'httpStatus', 'describeAccountAttributesResponse_httpStatus' - The response's http status code.
newDescribeAccountAttributesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAccountAttributesResponse
newDescribeAccountAttributesResponse :: Int -> DescribeAccountAttributesResponse
newDescribeAccountAttributesResponse Int
pHttpStatus_ =
  DescribeAccountAttributesResponse' :: Maybe ResourceQuotas -> Int -> DescribeAccountAttributesResponse
DescribeAccountAttributesResponse'
    { $sel:resourceQuotas:DescribeAccountAttributesResponse' :: Maybe ResourceQuotas
resourceQuotas =
        Maybe ResourceQuotas
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAccountAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Elastic Beanstalk resource quotas associated with the calling AWS
-- account.
describeAccountAttributesResponse_resourceQuotas :: Lens.Lens' DescribeAccountAttributesResponse (Prelude.Maybe ResourceQuotas)
describeAccountAttributesResponse_resourceQuotas :: (Maybe ResourceQuotas -> f (Maybe ResourceQuotas))
-> DescribeAccountAttributesResponse
-> f DescribeAccountAttributesResponse
describeAccountAttributesResponse_resourceQuotas = (DescribeAccountAttributesResponse -> Maybe ResourceQuotas)
-> (DescribeAccountAttributesResponse
    -> Maybe ResourceQuotas -> DescribeAccountAttributesResponse)
-> Lens
     DescribeAccountAttributesResponse
     DescribeAccountAttributesResponse
     (Maybe ResourceQuotas)
     (Maybe ResourceQuotas)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountAttributesResponse' {Maybe ResourceQuotas
resourceQuotas :: Maybe ResourceQuotas
$sel:resourceQuotas:DescribeAccountAttributesResponse' :: DescribeAccountAttributesResponse -> Maybe ResourceQuotas
resourceQuotas} -> Maybe ResourceQuotas
resourceQuotas) (\s :: DescribeAccountAttributesResponse
s@DescribeAccountAttributesResponse' {} Maybe ResourceQuotas
a -> DescribeAccountAttributesResponse
s {$sel:resourceQuotas:DescribeAccountAttributesResponse' :: Maybe ResourceQuotas
resourceQuotas = Maybe ResourceQuotas
a} :: DescribeAccountAttributesResponse)

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

instance
  Prelude.NFData
    DescribeAccountAttributesResponse