{-# 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.GetSnapshotLimits
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Obtains the manual snapshot limits for a directory.
module Amazonka.DirectoryService.GetSnapshotLimits
  ( -- * Creating a Request
    GetSnapshotLimits (..),
    newGetSnapshotLimits,

    -- * Request Lenses
    getSnapshotLimits_directoryId,

    -- * Destructuring the Response
    GetSnapshotLimitsResponse (..),
    newGetSnapshotLimitsResponse,

    -- * Response Lenses
    getSnapshotLimitsResponse_snapshotLimits,
    getSnapshotLimitsResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'GetSnapshotLimits' 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:
--
-- 'directoryId', 'getSnapshotLimits_directoryId' - Contains the identifier of the directory to obtain the limits for.
newGetSnapshotLimits ::
  -- | 'directoryId'
  Prelude.Text ->
  GetSnapshotLimits
newGetSnapshotLimits :: Text -> GetSnapshotLimits
newGetSnapshotLimits Text
pDirectoryId_ =
  GetSnapshotLimits' {$sel:directoryId:GetSnapshotLimits' :: Text
directoryId = Text
pDirectoryId_}

-- | Contains the identifier of the directory to obtain the limits for.
getSnapshotLimits_directoryId :: Lens.Lens' GetSnapshotLimits Prelude.Text
getSnapshotLimits_directoryId :: Lens' GetSnapshotLimits Text
getSnapshotLimits_directoryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSnapshotLimits' {Text
directoryId :: Text
$sel:directoryId:GetSnapshotLimits' :: GetSnapshotLimits -> Text
directoryId} -> Text
directoryId) (\s :: GetSnapshotLimits
s@GetSnapshotLimits' {} Text
a -> GetSnapshotLimits
s {$sel:directoryId:GetSnapshotLimits' :: Text
directoryId = Text
a} :: GetSnapshotLimits)

instance Core.AWSRequest GetSnapshotLimits where
  type
    AWSResponse GetSnapshotLimits =
      GetSnapshotLimitsResponse
  request :: (Service -> Service)
-> GetSnapshotLimits -> Request GetSnapshotLimits
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSnapshotLimits
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSnapshotLimits)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe SnapshotLimits -> Int -> GetSnapshotLimitsResponse
GetSnapshotLimitsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SnapshotLimits")
            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 GetSnapshotLimits where
  hashWithSalt :: Int -> GetSnapshotLimits -> Int
hashWithSalt Int
_salt GetSnapshotLimits' {Text
directoryId :: Text
$sel:directoryId:GetSnapshotLimits' :: GetSnapshotLimits -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryId

instance Prelude.NFData GetSnapshotLimits where
  rnf :: GetSnapshotLimits -> ()
rnf GetSnapshotLimits' {Text
directoryId :: Text
$sel:directoryId:GetSnapshotLimits' :: GetSnapshotLimits -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
directoryId

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

instance Data.ToJSON GetSnapshotLimits where
  toJSON :: GetSnapshotLimits -> Value
toJSON GetSnapshotLimits' {Text
directoryId :: Text
$sel:directoryId:GetSnapshotLimits' :: GetSnapshotLimits -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"DirectoryId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
directoryId)]
      )

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

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

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

-- |
-- Create a value of 'GetSnapshotLimitsResponse' 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:
--
-- 'snapshotLimits', 'getSnapshotLimitsResponse_snapshotLimits' - A SnapshotLimits object that contains the manual snapshot limits for the
-- specified directory.
--
-- 'httpStatus', 'getSnapshotLimitsResponse_httpStatus' - The response's http status code.
newGetSnapshotLimitsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSnapshotLimitsResponse
newGetSnapshotLimitsResponse :: Int -> GetSnapshotLimitsResponse
newGetSnapshotLimitsResponse Int
pHttpStatus_ =
  GetSnapshotLimitsResponse'
    { $sel:snapshotLimits:GetSnapshotLimitsResponse' :: Maybe SnapshotLimits
snapshotLimits =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSnapshotLimitsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A SnapshotLimits object that contains the manual snapshot limits for the
-- specified directory.
getSnapshotLimitsResponse_snapshotLimits :: Lens.Lens' GetSnapshotLimitsResponse (Prelude.Maybe SnapshotLimits)
getSnapshotLimitsResponse_snapshotLimits :: Lens' GetSnapshotLimitsResponse (Maybe SnapshotLimits)
getSnapshotLimitsResponse_snapshotLimits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSnapshotLimitsResponse' {Maybe SnapshotLimits
snapshotLimits :: Maybe SnapshotLimits
$sel:snapshotLimits:GetSnapshotLimitsResponse' :: GetSnapshotLimitsResponse -> Maybe SnapshotLimits
snapshotLimits} -> Maybe SnapshotLimits
snapshotLimits) (\s :: GetSnapshotLimitsResponse
s@GetSnapshotLimitsResponse' {} Maybe SnapshotLimits
a -> GetSnapshotLimitsResponse
s {$sel:snapshotLimits:GetSnapshotLimitsResponse' :: Maybe SnapshotLimits
snapshotLimits = Maybe SnapshotLimits
a} :: GetSnapshotLimitsResponse)

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

instance Prelude.NFData GetSnapshotLimitsResponse where
  rnf :: GetSnapshotLimitsResponse -> ()
rnf GetSnapshotLimitsResponse' {Int
Maybe SnapshotLimits
httpStatus :: Int
snapshotLimits :: Maybe SnapshotLimits
$sel:httpStatus:GetSnapshotLimitsResponse' :: GetSnapshotLimitsResponse -> Int
$sel:snapshotLimits:GetSnapshotLimitsResponse' :: GetSnapshotLimitsResponse -> Maybe SnapshotLimits
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SnapshotLimits
snapshotLimits
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus