{-# 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.APIGateway.GetAccount
-- 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 current Account resource.
module Amazonka.APIGateway.GetAccount
  ( -- * Creating a Request
    GetAccount (..),
    newGetAccount,

    -- * Destructuring the Response
    Account (..),
    newAccount,

    -- * Response Lenses
    account_apiKeyVersion,
    account_cloudwatchRoleArn,
    account_features,
    account_throttleSettings,
  )
where

import Amazonka.APIGateway.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

-- | Requests API Gateway to get information about the current Account
-- resource.
--
-- /See:/ 'newGetAccount' smart constructor.
data GetAccount = GetAccount'
  {
  }
  deriving (GetAccount -> GetAccount -> Bool
(GetAccount -> GetAccount -> Bool)
-> (GetAccount -> GetAccount -> Bool) -> Eq GetAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccount -> GetAccount -> Bool
$c/= :: GetAccount -> GetAccount -> Bool
== :: GetAccount -> GetAccount -> Bool
$c== :: GetAccount -> GetAccount -> Bool
Prelude.Eq, ReadPrec [GetAccount]
ReadPrec GetAccount
Int -> ReadS GetAccount
ReadS [GetAccount]
(Int -> ReadS GetAccount)
-> ReadS [GetAccount]
-> ReadPrec GetAccount
-> ReadPrec [GetAccount]
-> Read GetAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccount]
$creadListPrec :: ReadPrec [GetAccount]
readPrec :: ReadPrec GetAccount
$creadPrec :: ReadPrec GetAccount
readList :: ReadS [GetAccount]
$creadList :: ReadS [GetAccount]
readsPrec :: Int -> ReadS GetAccount
$creadsPrec :: Int -> ReadS GetAccount
Prelude.Read, Int -> GetAccount -> ShowS
[GetAccount] -> ShowS
GetAccount -> String
(Int -> GetAccount -> ShowS)
-> (GetAccount -> String)
-> ([GetAccount] -> ShowS)
-> Show GetAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccount] -> ShowS
$cshowList :: [GetAccount] -> ShowS
show :: GetAccount -> String
$cshow :: GetAccount -> String
showsPrec :: Int -> GetAccount -> ShowS
$cshowsPrec :: Int -> GetAccount -> ShowS
Prelude.Show, (forall x. GetAccount -> Rep GetAccount x)
-> (forall x. Rep GetAccount x -> GetAccount) -> Generic GetAccount
forall x. Rep GetAccount x -> GetAccount
forall x. GetAccount -> Rep GetAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAccount x -> GetAccount
$cfrom :: forall x. GetAccount -> Rep GetAccount x
Prelude.Generic)

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

instance Core.AWSRequest GetAccount where
  type AWSResponse GetAccount = Account
  request :: GetAccount -> Request GetAccount
request = Service -> GetAccount -> Request GetAccount
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAccount)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAccount))
-> Logger
-> Service
-> Proxy GetAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAccount)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> Object -> Either String Account
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable GetAccount

instance Prelude.NFData GetAccount

instance Core.ToHeaders GetAccount where
  toHeaders :: GetAccount -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetAccount -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

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

instance Core.ToQuery GetAccount where
  toQuery :: GetAccount -> QueryString
toQuery = QueryString -> GetAccount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty