{-# 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.Lambda.GetAccountSettings
-- 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)
--
-- Retrieves details about your account\'s
-- <https://docs.aws.amazon.com/lambda/latest/dg/limits.html limits> and
-- usage in an Amazon Web Services Region.
module Amazonka.Lambda.GetAccountSettings
  ( -- * Creating a Request
    GetAccountSettings (..),
    newGetAccountSettings,

    -- * Destructuring the Response
    GetAccountSettingsResponse (..),
    newGetAccountSettingsResponse,

    -- * Response Lenses
    getAccountSettingsResponse_accountLimit,
    getAccountSettingsResponse_accountUsage,
    getAccountSettingsResponse_httpStatus,
  )
where

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

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

instance Core.AWSRequest GetAccountSettings where
  type
    AWSResponse GetAccountSettings =
      GetAccountSettingsResponse
  request :: GetAccountSettings -> Request GetAccountSettings
request = Service -> GetAccountSettings -> Request GetAccountSettings
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAccountSettings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAccountSettings))
-> Logger
-> Service
-> Proxy GetAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAccountSettings)))
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 ->
          Maybe AccountLimit
-> Maybe AccountUsage -> Int -> GetAccountSettingsResponse
GetAccountSettingsResponse'
            (Maybe AccountLimit
 -> Maybe AccountUsage -> Int -> GetAccountSettingsResponse)
-> Either String (Maybe AccountLimit)
-> Either
     String (Maybe AccountUsage -> Int -> GetAccountSettingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe AccountLimit)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"AccountLimit")
            Either
  String (Maybe AccountUsage -> Int -> GetAccountSettingsResponse)
-> Either String (Maybe AccountUsage)
-> Either String (Int -> GetAccountSettingsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String (Maybe AccountUsage)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"AccountUsage")
            Either String (Int -> GetAccountSettingsResponse)
-> Either String Int -> Either String GetAccountSettingsResponse
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 GetAccountSettings

instance Prelude.NFData GetAccountSettings

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

instance Core.ToPath GetAccountSettings where
  toPath :: GetAccountSettings -> ByteString
toPath =
    ByteString -> GetAccountSettings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2016-08-19/account-settings/"

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

-- | /See:/ 'newGetAccountSettingsResponse' smart constructor.
data GetAccountSettingsResponse = GetAccountSettingsResponse'
  { -- | Limits that are related to concurrency and code storage.
    GetAccountSettingsResponse -> Maybe AccountLimit
accountLimit :: Prelude.Maybe AccountLimit,
    -- | The number of functions and amount of storage in use.
    GetAccountSettingsResponse -> Maybe AccountUsage
accountUsage :: Prelude.Maybe AccountUsage,
    -- | The response's http status code.
    GetAccountSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetAccountSettingsResponse -> GetAccountSettingsResponse -> Bool
(GetAccountSettingsResponse -> GetAccountSettingsResponse -> Bool)
-> (GetAccountSettingsResponse
    -> GetAccountSettingsResponse -> Bool)
-> Eq GetAccountSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountSettingsResponse -> GetAccountSettingsResponse -> Bool
$c/= :: GetAccountSettingsResponse -> GetAccountSettingsResponse -> Bool
== :: GetAccountSettingsResponse -> GetAccountSettingsResponse -> Bool
$c== :: GetAccountSettingsResponse -> GetAccountSettingsResponse -> Bool
Prelude.Eq, ReadPrec [GetAccountSettingsResponse]
ReadPrec GetAccountSettingsResponse
Int -> ReadS GetAccountSettingsResponse
ReadS [GetAccountSettingsResponse]
(Int -> ReadS GetAccountSettingsResponse)
-> ReadS [GetAccountSettingsResponse]
-> ReadPrec GetAccountSettingsResponse
-> ReadPrec [GetAccountSettingsResponse]
-> Read GetAccountSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccountSettingsResponse]
$creadListPrec :: ReadPrec [GetAccountSettingsResponse]
readPrec :: ReadPrec GetAccountSettingsResponse
$creadPrec :: ReadPrec GetAccountSettingsResponse
readList :: ReadS [GetAccountSettingsResponse]
$creadList :: ReadS [GetAccountSettingsResponse]
readsPrec :: Int -> ReadS GetAccountSettingsResponse
$creadsPrec :: Int -> ReadS GetAccountSettingsResponse
Prelude.Read, Int -> GetAccountSettingsResponse -> ShowS
[GetAccountSettingsResponse] -> ShowS
GetAccountSettingsResponse -> String
(Int -> GetAccountSettingsResponse -> ShowS)
-> (GetAccountSettingsResponse -> String)
-> ([GetAccountSettingsResponse] -> ShowS)
-> Show GetAccountSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccountSettingsResponse] -> ShowS
$cshowList :: [GetAccountSettingsResponse] -> ShowS
show :: GetAccountSettingsResponse -> String
$cshow :: GetAccountSettingsResponse -> String
showsPrec :: Int -> GetAccountSettingsResponse -> ShowS
$cshowsPrec :: Int -> GetAccountSettingsResponse -> ShowS
Prelude.Show, (forall x.
 GetAccountSettingsResponse -> Rep GetAccountSettingsResponse x)
-> (forall x.
    Rep GetAccountSettingsResponse x -> GetAccountSettingsResponse)
-> Generic GetAccountSettingsResponse
forall x.
Rep GetAccountSettingsResponse x -> GetAccountSettingsResponse
forall x.
GetAccountSettingsResponse -> Rep GetAccountSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAccountSettingsResponse x -> GetAccountSettingsResponse
$cfrom :: forall x.
GetAccountSettingsResponse -> Rep GetAccountSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAccountSettingsResponse' 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:
--
-- 'accountLimit', 'getAccountSettingsResponse_accountLimit' - Limits that are related to concurrency and code storage.
--
-- 'accountUsage', 'getAccountSettingsResponse_accountUsage' - The number of functions and amount of storage in use.
--
-- 'httpStatus', 'getAccountSettingsResponse_httpStatus' - The response's http status code.
newGetAccountSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAccountSettingsResponse
newGetAccountSettingsResponse :: Int -> GetAccountSettingsResponse
newGetAccountSettingsResponse Int
pHttpStatus_ =
  GetAccountSettingsResponse' :: Maybe AccountLimit
-> Maybe AccountUsage -> Int -> GetAccountSettingsResponse
GetAccountSettingsResponse'
    { $sel:accountLimit:GetAccountSettingsResponse' :: Maybe AccountLimit
accountLimit =
        Maybe AccountLimit
forall a. Maybe a
Prelude.Nothing,
      $sel:accountUsage:GetAccountSettingsResponse' :: Maybe AccountUsage
accountUsage = Maybe AccountUsage
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAccountSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Limits that are related to concurrency and code storage.
getAccountSettingsResponse_accountLimit :: Lens.Lens' GetAccountSettingsResponse (Prelude.Maybe AccountLimit)
getAccountSettingsResponse_accountLimit :: (Maybe AccountLimit -> f (Maybe AccountLimit))
-> GetAccountSettingsResponse -> f GetAccountSettingsResponse
getAccountSettingsResponse_accountLimit = (GetAccountSettingsResponse -> Maybe AccountLimit)
-> (GetAccountSettingsResponse
    -> Maybe AccountLimit -> GetAccountSettingsResponse)
-> Lens
     GetAccountSettingsResponse
     GetAccountSettingsResponse
     (Maybe AccountLimit)
     (Maybe AccountLimit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountSettingsResponse' {Maybe AccountLimit
accountLimit :: Maybe AccountLimit
$sel:accountLimit:GetAccountSettingsResponse' :: GetAccountSettingsResponse -> Maybe AccountLimit
accountLimit} -> Maybe AccountLimit
accountLimit) (\s :: GetAccountSettingsResponse
s@GetAccountSettingsResponse' {} Maybe AccountLimit
a -> GetAccountSettingsResponse
s {$sel:accountLimit:GetAccountSettingsResponse' :: Maybe AccountLimit
accountLimit = Maybe AccountLimit
a} :: GetAccountSettingsResponse)

-- | The number of functions and amount of storage in use.
getAccountSettingsResponse_accountUsage :: Lens.Lens' GetAccountSettingsResponse (Prelude.Maybe AccountUsage)
getAccountSettingsResponse_accountUsage :: (Maybe AccountUsage -> f (Maybe AccountUsage))
-> GetAccountSettingsResponse -> f GetAccountSettingsResponse
getAccountSettingsResponse_accountUsage = (GetAccountSettingsResponse -> Maybe AccountUsage)
-> (GetAccountSettingsResponse
    -> Maybe AccountUsage -> GetAccountSettingsResponse)
-> Lens
     GetAccountSettingsResponse
     GetAccountSettingsResponse
     (Maybe AccountUsage)
     (Maybe AccountUsage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountSettingsResponse' {Maybe AccountUsage
accountUsage :: Maybe AccountUsage
$sel:accountUsage:GetAccountSettingsResponse' :: GetAccountSettingsResponse -> Maybe AccountUsage
accountUsage} -> Maybe AccountUsage
accountUsage) (\s :: GetAccountSettingsResponse
s@GetAccountSettingsResponse' {} Maybe AccountUsage
a -> GetAccountSettingsResponse
s {$sel:accountUsage:GetAccountSettingsResponse' :: Maybe AccountUsage
accountUsage = Maybe AccountUsage
a} :: GetAccountSettingsResponse)

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

instance Prelude.NFData GetAccountSettingsResponse