{-# 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.DirectoryService.GetDirectoryLimits
-- 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)
--
-- Obtains directory limit information for the current Region.
module Amazonka.DirectoryService.GetDirectoryLimits
  ( -- * Creating a Request
    GetDirectoryLimits (..),
    newGetDirectoryLimits,

    -- * Destructuring the Response
    GetDirectoryLimitsResponse (..),
    newGetDirectoryLimitsResponse,

    -- * Response Lenses
    getDirectoryLimitsResponse_directoryLimits,
    getDirectoryLimitsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.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

-- | Contains the inputs for the GetDirectoryLimits operation.
--
-- /See:/ 'newGetDirectoryLimits' smart constructor.
data GetDirectoryLimits = GetDirectoryLimits'
  {
  }
  deriving (GetDirectoryLimits -> GetDirectoryLimits -> Bool
(GetDirectoryLimits -> GetDirectoryLimits -> Bool)
-> (GetDirectoryLimits -> GetDirectoryLimits -> Bool)
-> Eq GetDirectoryLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDirectoryLimits -> GetDirectoryLimits -> Bool
$c/= :: GetDirectoryLimits -> GetDirectoryLimits -> Bool
== :: GetDirectoryLimits -> GetDirectoryLimits -> Bool
$c== :: GetDirectoryLimits -> GetDirectoryLimits -> Bool
Prelude.Eq, ReadPrec [GetDirectoryLimits]
ReadPrec GetDirectoryLimits
Int -> ReadS GetDirectoryLimits
ReadS [GetDirectoryLimits]
(Int -> ReadS GetDirectoryLimits)
-> ReadS [GetDirectoryLimits]
-> ReadPrec GetDirectoryLimits
-> ReadPrec [GetDirectoryLimits]
-> Read GetDirectoryLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDirectoryLimits]
$creadListPrec :: ReadPrec [GetDirectoryLimits]
readPrec :: ReadPrec GetDirectoryLimits
$creadPrec :: ReadPrec GetDirectoryLimits
readList :: ReadS [GetDirectoryLimits]
$creadList :: ReadS [GetDirectoryLimits]
readsPrec :: Int -> ReadS GetDirectoryLimits
$creadsPrec :: Int -> ReadS GetDirectoryLimits
Prelude.Read, Int -> GetDirectoryLimits -> ShowS
[GetDirectoryLimits] -> ShowS
GetDirectoryLimits -> String
(Int -> GetDirectoryLimits -> ShowS)
-> (GetDirectoryLimits -> String)
-> ([GetDirectoryLimits] -> ShowS)
-> Show GetDirectoryLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDirectoryLimits] -> ShowS
$cshowList :: [GetDirectoryLimits] -> ShowS
show :: GetDirectoryLimits -> String
$cshow :: GetDirectoryLimits -> String
showsPrec :: Int -> GetDirectoryLimits -> ShowS
$cshowsPrec :: Int -> GetDirectoryLimits -> ShowS
Prelude.Show, (forall x. GetDirectoryLimits -> Rep GetDirectoryLimits x)
-> (forall x. Rep GetDirectoryLimits x -> GetDirectoryLimits)
-> Generic GetDirectoryLimits
forall x. Rep GetDirectoryLimits x -> GetDirectoryLimits
forall x. GetDirectoryLimits -> Rep GetDirectoryLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDirectoryLimits x -> GetDirectoryLimits
$cfrom :: forall x. GetDirectoryLimits -> Rep GetDirectoryLimits x
Prelude.Generic)

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

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

instance Prelude.NFData GetDirectoryLimits

instance Core.ToHeaders GetDirectoryLimits where
  toHeaders :: GetDirectoryLimits -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetDirectoryLimits -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DirectoryService_20150416.GetDirectoryLimits" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON GetDirectoryLimits where
  toJSON :: GetDirectoryLimits -> Value
toJSON = Value -> GetDirectoryLimits -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

-- | Contains the results of the GetDirectoryLimits operation.
--
-- /See:/ 'newGetDirectoryLimitsResponse' smart constructor.
data GetDirectoryLimitsResponse = GetDirectoryLimitsResponse'
  { -- | A DirectoryLimits object that contains the directory limits for the
    -- current Region.
    GetDirectoryLimitsResponse -> Maybe DirectoryLimits
directoryLimits :: Prelude.Maybe DirectoryLimits,
    -- | The response's http status code.
    GetDirectoryLimitsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDirectoryLimitsResponse -> GetDirectoryLimitsResponse -> Bool
(GetDirectoryLimitsResponse -> GetDirectoryLimitsResponse -> Bool)
-> (GetDirectoryLimitsResponse
    -> GetDirectoryLimitsResponse -> Bool)
-> Eq GetDirectoryLimitsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDirectoryLimitsResponse -> GetDirectoryLimitsResponse -> Bool
$c/= :: GetDirectoryLimitsResponse -> GetDirectoryLimitsResponse -> Bool
== :: GetDirectoryLimitsResponse -> GetDirectoryLimitsResponse -> Bool
$c== :: GetDirectoryLimitsResponse -> GetDirectoryLimitsResponse -> Bool
Prelude.Eq, ReadPrec [GetDirectoryLimitsResponse]
ReadPrec GetDirectoryLimitsResponse
Int -> ReadS GetDirectoryLimitsResponse
ReadS [GetDirectoryLimitsResponse]
(Int -> ReadS GetDirectoryLimitsResponse)
-> ReadS [GetDirectoryLimitsResponse]
-> ReadPrec GetDirectoryLimitsResponse
-> ReadPrec [GetDirectoryLimitsResponse]
-> Read GetDirectoryLimitsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDirectoryLimitsResponse]
$creadListPrec :: ReadPrec [GetDirectoryLimitsResponse]
readPrec :: ReadPrec GetDirectoryLimitsResponse
$creadPrec :: ReadPrec GetDirectoryLimitsResponse
readList :: ReadS [GetDirectoryLimitsResponse]
$creadList :: ReadS [GetDirectoryLimitsResponse]
readsPrec :: Int -> ReadS GetDirectoryLimitsResponse
$creadsPrec :: Int -> ReadS GetDirectoryLimitsResponse
Prelude.Read, Int -> GetDirectoryLimitsResponse -> ShowS
[GetDirectoryLimitsResponse] -> ShowS
GetDirectoryLimitsResponse -> String
(Int -> GetDirectoryLimitsResponse -> ShowS)
-> (GetDirectoryLimitsResponse -> String)
-> ([GetDirectoryLimitsResponse] -> ShowS)
-> Show GetDirectoryLimitsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDirectoryLimitsResponse] -> ShowS
$cshowList :: [GetDirectoryLimitsResponse] -> ShowS
show :: GetDirectoryLimitsResponse -> String
$cshow :: GetDirectoryLimitsResponse -> String
showsPrec :: Int -> GetDirectoryLimitsResponse -> ShowS
$cshowsPrec :: Int -> GetDirectoryLimitsResponse -> ShowS
Prelude.Show, (forall x.
 GetDirectoryLimitsResponse -> Rep GetDirectoryLimitsResponse x)
-> (forall x.
    Rep GetDirectoryLimitsResponse x -> GetDirectoryLimitsResponse)
-> Generic GetDirectoryLimitsResponse
forall x.
Rep GetDirectoryLimitsResponse x -> GetDirectoryLimitsResponse
forall x.
GetDirectoryLimitsResponse -> Rep GetDirectoryLimitsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDirectoryLimitsResponse x -> GetDirectoryLimitsResponse
$cfrom :: forall x.
GetDirectoryLimitsResponse -> Rep GetDirectoryLimitsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDirectoryLimitsResponse' 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:
--
-- 'directoryLimits', 'getDirectoryLimitsResponse_directoryLimits' - A DirectoryLimits object that contains the directory limits for the
-- current Region.
--
-- 'httpStatus', 'getDirectoryLimitsResponse_httpStatus' - The response's http status code.
newGetDirectoryLimitsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDirectoryLimitsResponse
newGetDirectoryLimitsResponse :: Int -> GetDirectoryLimitsResponse
newGetDirectoryLimitsResponse Int
pHttpStatus_ =
  GetDirectoryLimitsResponse' :: Maybe DirectoryLimits -> Int -> GetDirectoryLimitsResponse
GetDirectoryLimitsResponse'
    { $sel:directoryLimits:GetDirectoryLimitsResponse' :: Maybe DirectoryLimits
directoryLimits =
        Maybe DirectoryLimits
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDirectoryLimitsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A DirectoryLimits object that contains the directory limits for the
-- current Region.
getDirectoryLimitsResponse_directoryLimits :: Lens.Lens' GetDirectoryLimitsResponse (Prelude.Maybe DirectoryLimits)
getDirectoryLimitsResponse_directoryLimits :: (Maybe DirectoryLimits -> f (Maybe DirectoryLimits))
-> GetDirectoryLimitsResponse -> f GetDirectoryLimitsResponse
getDirectoryLimitsResponse_directoryLimits = (GetDirectoryLimitsResponse -> Maybe DirectoryLimits)
-> (GetDirectoryLimitsResponse
    -> Maybe DirectoryLimits -> GetDirectoryLimitsResponse)
-> Lens
     GetDirectoryLimitsResponse
     GetDirectoryLimitsResponse
     (Maybe DirectoryLimits)
     (Maybe DirectoryLimits)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDirectoryLimitsResponse' {Maybe DirectoryLimits
directoryLimits :: Maybe DirectoryLimits
$sel:directoryLimits:GetDirectoryLimitsResponse' :: GetDirectoryLimitsResponse -> Maybe DirectoryLimits
directoryLimits} -> Maybe DirectoryLimits
directoryLimits) (\s :: GetDirectoryLimitsResponse
s@GetDirectoryLimitsResponse' {} Maybe DirectoryLimits
a -> GetDirectoryLimitsResponse
s {$sel:directoryLimits:GetDirectoryLimitsResponse' :: Maybe DirectoryLimits
directoryLimits = Maybe DirectoryLimits
a} :: GetDirectoryLimitsResponse)

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

instance Prelude.NFData GetDirectoryLimitsResponse