{-# 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.DynamoDB.DescribeTableReplicaAutoScaling
-- 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)
--
-- Describes auto scaling settings across replicas of the global table at
-- once.
--
-- This operation only applies to
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html Version 2019.11.21>
-- of global tables.
module Amazonka.DynamoDB.DescribeTableReplicaAutoScaling
  ( -- * Creating a Request
    DescribeTableReplicaAutoScaling (..),
    newDescribeTableReplicaAutoScaling,

    -- * Request Lenses
    describeTableReplicaAutoScaling_tableName,

    -- * Destructuring the Response
    DescribeTableReplicaAutoScalingResponse (..),
    newDescribeTableReplicaAutoScalingResponse,

    -- * Response Lenses
    describeTableReplicaAutoScalingResponse_tableAutoScalingDescription,
    describeTableReplicaAutoScalingResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'DescribeTableReplicaAutoScaling' 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:
--
-- 'tableName', 'describeTableReplicaAutoScaling_tableName' - The name of the table.
newDescribeTableReplicaAutoScaling ::
  -- | 'tableName'
  Prelude.Text ->
  DescribeTableReplicaAutoScaling
newDescribeTableReplicaAutoScaling :: Text -> DescribeTableReplicaAutoScaling
newDescribeTableReplicaAutoScaling Text
pTableName_ =
  DescribeTableReplicaAutoScaling' :: Text -> DescribeTableReplicaAutoScaling
DescribeTableReplicaAutoScaling'
    { $sel:tableName:DescribeTableReplicaAutoScaling' :: Text
tableName =
        Text
pTableName_
    }

-- | The name of the table.
describeTableReplicaAutoScaling_tableName :: Lens.Lens' DescribeTableReplicaAutoScaling Prelude.Text
describeTableReplicaAutoScaling_tableName :: (Text -> f Text)
-> DescribeTableReplicaAutoScaling
-> f DescribeTableReplicaAutoScaling
describeTableReplicaAutoScaling_tableName = (DescribeTableReplicaAutoScaling -> Text)
-> (DescribeTableReplicaAutoScaling
    -> Text -> DescribeTableReplicaAutoScaling)
-> Lens
     DescribeTableReplicaAutoScaling
     DescribeTableReplicaAutoScaling
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableReplicaAutoScaling' {Text
tableName :: Text
$sel:tableName:DescribeTableReplicaAutoScaling' :: DescribeTableReplicaAutoScaling -> Text
tableName} -> Text
tableName) (\s :: DescribeTableReplicaAutoScaling
s@DescribeTableReplicaAutoScaling' {} Text
a -> DescribeTableReplicaAutoScaling
s {$sel:tableName:DescribeTableReplicaAutoScaling' :: Text
tableName = Text
a} :: DescribeTableReplicaAutoScaling)

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

instance
  Prelude.NFData
    DescribeTableReplicaAutoScaling

instance
  Core.ToHeaders
    DescribeTableReplicaAutoScaling
  where
  toHeaders :: DescribeTableReplicaAutoScaling -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeTableReplicaAutoScaling -> 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
"DynamoDB_20120810.DescribeTableReplicaAutoScaling" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeTableReplicaAutoScaling where
  toJSON :: DescribeTableReplicaAutoScaling -> Value
toJSON DescribeTableReplicaAutoScaling' {Text
tableName :: Text
$sel:tableName:DescribeTableReplicaAutoScaling' :: DescribeTableReplicaAutoScaling -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName)]
      )

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

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

-- | /See:/ 'newDescribeTableReplicaAutoScalingResponse' smart constructor.
data DescribeTableReplicaAutoScalingResponse = DescribeTableReplicaAutoScalingResponse'
  { -- | Represents the auto scaling properties of the table.
    DescribeTableReplicaAutoScalingResponse
-> Maybe TableAutoScalingDescription
tableAutoScalingDescription :: Prelude.Maybe TableAutoScalingDescription,
    -- | The response's http status code.
    DescribeTableReplicaAutoScalingResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeTableReplicaAutoScalingResponse
-> DescribeTableReplicaAutoScalingResponse -> Bool
(DescribeTableReplicaAutoScalingResponse
 -> DescribeTableReplicaAutoScalingResponse -> Bool)
-> (DescribeTableReplicaAutoScalingResponse
    -> DescribeTableReplicaAutoScalingResponse -> Bool)
-> Eq DescribeTableReplicaAutoScalingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTableReplicaAutoScalingResponse
-> DescribeTableReplicaAutoScalingResponse -> Bool
$c/= :: DescribeTableReplicaAutoScalingResponse
-> DescribeTableReplicaAutoScalingResponse -> Bool
== :: DescribeTableReplicaAutoScalingResponse
-> DescribeTableReplicaAutoScalingResponse -> Bool
$c== :: DescribeTableReplicaAutoScalingResponse
-> DescribeTableReplicaAutoScalingResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTableReplicaAutoScalingResponse]
ReadPrec DescribeTableReplicaAutoScalingResponse
Int -> ReadS DescribeTableReplicaAutoScalingResponse
ReadS [DescribeTableReplicaAutoScalingResponse]
(Int -> ReadS DescribeTableReplicaAutoScalingResponse)
-> ReadS [DescribeTableReplicaAutoScalingResponse]
-> ReadPrec DescribeTableReplicaAutoScalingResponse
-> ReadPrec [DescribeTableReplicaAutoScalingResponse]
-> Read DescribeTableReplicaAutoScalingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTableReplicaAutoScalingResponse]
$creadListPrec :: ReadPrec [DescribeTableReplicaAutoScalingResponse]
readPrec :: ReadPrec DescribeTableReplicaAutoScalingResponse
$creadPrec :: ReadPrec DescribeTableReplicaAutoScalingResponse
readList :: ReadS [DescribeTableReplicaAutoScalingResponse]
$creadList :: ReadS [DescribeTableReplicaAutoScalingResponse]
readsPrec :: Int -> ReadS DescribeTableReplicaAutoScalingResponse
$creadsPrec :: Int -> ReadS DescribeTableReplicaAutoScalingResponse
Prelude.Read, Int -> DescribeTableReplicaAutoScalingResponse -> ShowS
[DescribeTableReplicaAutoScalingResponse] -> ShowS
DescribeTableReplicaAutoScalingResponse -> String
(Int -> DescribeTableReplicaAutoScalingResponse -> ShowS)
-> (DescribeTableReplicaAutoScalingResponse -> String)
-> ([DescribeTableReplicaAutoScalingResponse] -> ShowS)
-> Show DescribeTableReplicaAutoScalingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTableReplicaAutoScalingResponse] -> ShowS
$cshowList :: [DescribeTableReplicaAutoScalingResponse] -> ShowS
show :: DescribeTableReplicaAutoScalingResponse -> String
$cshow :: DescribeTableReplicaAutoScalingResponse -> String
showsPrec :: Int -> DescribeTableReplicaAutoScalingResponse -> ShowS
$cshowsPrec :: Int -> DescribeTableReplicaAutoScalingResponse -> ShowS
Prelude.Show, (forall x.
 DescribeTableReplicaAutoScalingResponse
 -> Rep DescribeTableReplicaAutoScalingResponse x)
-> (forall x.
    Rep DescribeTableReplicaAutoScalingResponse x
    -> DescribeTableReplicaAutoScalingResponse)
-> Generic DescribeTableReplicaAutoScalingResponse
forall x.
Rep DescribeTableReplicaAutoScalingResponse x
-> DescribeTableReplicaAutoScalingResponse
forall x.
DescribeTableReplicaAutoScalingResponse
-> Rep DescribeTableReplicaAutoScalingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTableReplicaAutoScalingResponse x
-> DescribeTableReplicaAutoScalingResponse
$cfrom :: forall x.
DescribeTableReplicaAutoScalingResponse
-> Rep DescribeTableReplicaAutoScalingResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTableReplicaAutoScalingResponse' 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:
--
-- 'tableAutoScalingDescription', 'describeTableReplicaAutoScalingResponse_tableAutoScalingDescription' - Represents the auto scaling properties of the table.
--
-- 'httpStatus', 'describeTableReplicaAutoScalingResponse_httpStatus' - The response's http status code.
newDescribeTableReplicaAutoScalingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTableReplicaAutoScalingResponse
newDescribeTableReplicaAutoScalingResponse :: Int -> DescribeTableReplicaAutoScalingResponse
newDescribeTableReplicaAutoScalingResponse
  Int
pHttpStatus_ =
    DescribeTableReplicaAutoScalingResponse' :: Maybe TableAutoScalingDescription
-> Int -> DescribeTableReplicaAutoScalingResponse
DescribeTableReplicaAutoScalingResponse'
      { $sel:tableAutoScalingDescription:DescribeTableReplicaAutoScalingResponse' :: Maybe TableAutoScalingDescription
tableAutoScalingDescription =
          Maybe TableAutoScalingDescription
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeTableReplicaAutoScalingResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Represents the auto scaling properties of the table.
describeTableReplicaAutoScalingResponse_tableAutoScalingDescription :: Lens.Lens' DescribeTableReplicaAutoScalingResponse (Prelude.Maybe TableAutoScalingDescription)
describeTableReplicaAutoScalingResponse_tableAutoScalingDescription :: (Maybe TableAutoScalingDescription
 -> f (Maybe TableAutoScalingDescription))
-> DescribeTableReplicaAutoScalingResponse
-> f DescribeTableReplicaAutoScalingResponse
describeTableReplicaAutoScalingResponse_tableAutoScalingDescription = (DescribeTableReplicaAutoScalingResponse
 -> Maybe TableAutoScalingDescription)
-> (DescribeTableReplicaAutoScalingResponse
    -> Maybe TableAutoScalingDescription
    -> DescribeTableReplicaAutoScalingResponse)
-> Lens
     DescribeTableReplicaAutoScalingResponse
     DescribeTableReplicaAutoScalingResponse
     (Maybe TableAutoScalingDescription)
     (Maybe TableAutoScalingDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableReplicaAutoScalingResponse' {Maybe TableAutoScalingDescription
tableAutoScalingDescription :: Maybe TableAutoScalingDescription
$sel:tableAutoScalingDescription:DescribeTableReplicaAutoScalingResponse' :: DescribeTableReplicaAutoScalingResponse
-> Maybe TableAutoScalingDescription
tableAutoScalingDescription} -> Maybe TableAutoScalingDescription
tableAutoScalingDescription) (\s :: DescribeTableReplicaAutoScalingResponse
s@DescribeTableReplicaAutoScalingResponse' {} Maybe TableAutoScalingDescription
a -> DescribeTableReplicaAutoScalingResponse
s {$sel:tableAutoScalingDescription:DescribeTableReplicaAutoScalingResponse' :: Maybe TableAutoScalingDescription
tableAutoScalingDescription = Maybe TableAutoScalingDescription
a} :: DescribeTableReplicaAutoScalingResponse)

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

instance
  Prelude.NFData
    DescribeTableReplicaAutoScalingResponse