{-# 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.UpdateTableReplicaAutoScaling
-- 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)
--
-- Updates auto scaling settings on your global tables 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.UpdateTableReplicaAutoScaling
  ( -- * Creating a Request
    UpdateTableReplicaAutoScaling (..),
    newUpdateTableReplicaAutoScaling,

    -- * Request Lenses
    updateTableReplicaAutoScaling_replicaUpdates,
    updateTableReplicaAutoScaling_provisionedWriteCapacityAutoScalingUpdate,
    updateTableReplicaAutoScaling_globalSecondaryIndexUpdates,
    updateTableReplicaAutoScaling_tableName,

    -- * Destructuring the Response
    UpdateTableReplicaAutoScalingResponse (..),
    newUpdateTableReplicaAutoScalingResponse,

    -- * Response Lenses
    updateTableReplicaAutoScalingResponse_tableAutoScalingDescription,
    updateTableReplicaAutoScalingResponse_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:/ 'newUpdateTableReplicaAutoScaling' smart constructor.
data UpdateTableReplicaAutoScaling = UpdateTableReplicaAutoScaling'
  { -- | Represents the auto scaling settings of replicas of the table that will
    -- be modified.
    UpdateTableReplicaAutoScaling
-> Maybe (NonEmpty ReplicaAutoScalingUpdate)
replicaUpdates :: Prelude.Maybe (Prelude.NonEmpty ReplicaAutoScalingUpdate),
    UpdateTableReplicaAutoScaling -> Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate :: Prelude.Maybe AutoScalingSettingsUpdate,
    -- | Represents the auto scaling settings of the global secondary indexes of
    -- the replica to be updated.
    UpdateTableReplicaAutoScaling
-> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
globalSecondaryIndexUpdates :: Prelude.Maybe (Prelude.NonEmpty GlobalSecondaryIndexAutoScalingUpdate),
    -- | The name of the global table to be updated.
    UpdateTableReplicaAutoScaling -> Text
tableName :: Prelude.Text
  }
  deriving (UpdateTableReplicaAutoScaling
-> UpdateTableReplicaAutoScaling -> Bool
(UpdateTableReplicaAutoScaling
 -> UpdateTableReplicaAutoScaling -> Bool)
-> (UpdateTableReplicaAutoScaling
    -> UpdateTableReplicaAutoScaling -> Bool)
-> Eq UpdateTableReplicaAutoScaling
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTableReplicaAutoScaling
-> UpdateTableReplicaAutoScaling -> Bool
$c/= :: UpdateTableReplicaAutoScaling
-> UpdateTableReplicaAutoScaling -> Bool
== :: UpdateTableReplicaAutoScaling
-> UpdateTableReplicaAutoScaling -> Bool
$c== :: UpdateTableReplicaAutoScaling
-> UpdateTableReplicaAutoScaling -> Bool
Prelude.Eq, ReadPrec [UpdateTableReplicaAutoScaling]
ReadPrec UpdateTableReplicaAutoScaling
Int -> ReadS UpdateTableReplicaAutoScaling
ReadS [UpdateTableReplicaAutoScaling]
(Int -> ReadS UpdateTableReplicaAutoScaling)
-> ReadS [UpdateTableReplicaAutoScaling]
-> ReadPrec UpdateTableReplicaAutoScaling
-> ReadPrec [UpdateTableReplicaAutoScaling]
-> Read UpdateTableReplicaAutoScaling
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTableReplicaAutoScaling]
$creadListPrec :: ReadPrec [UpdateTableReplicaAutoScaling]
readPrec :: ReadPrec UpdateTableReplicaAutoScaling
$creadPrec :: ReadPrec UpdateTableReplicaAutoScaling
readList :: ReadS [UpdateTableReplicaAutoScaling]
$creadList :: ReadS [UpdateTableReplicaAutoScaling]
readsPrec :: Int -> ReadS UpdateTableReplicaAutoScaling
$creadsPrec :: Int -> ReadS UpdateTableReplicaAutoScaling
Prelude.Read, Int -> UpdateTableReplicaAutoScaling -> ShowS
[UpdateTableReplicaAutoScaling] -> ShowS
UpdateTableReplicaAutoScaling -> String
(Int -> UpdateTableReplicaAutoScaling -> ShowS)
-> (UpdateTableReplicaAutoScaling -> String)
-> ([UpdateTableReplicaAutoScaling] -> ShowS)
-> Show UpdateTableReplicaAutoScaling
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTableReplicaAutoScaling] -> ShowS
$cshowList :: [UpdateTableReplicaAutoScaling] -> ShowS
show :: UpdateTableReplicaAutoScaling -> String
$cshow :: UpdateTableReplicaAutoScaling -> String
showsPrec :: Int -> UpdateTableReplicaAutoScaling -> ShowS
$cshowsPrec :: Int -> UpdateTableReplicaAutoScaling -> ShowS
Prelude.Show, (forall x.
 UpdateTableReplicaAutoScaling
 -> Rep UpdateTableReplicaAutoScaling x)
-> (forall x.
    Rep UpdateTableReplicaAutoScaling x
    -> UpdateTableReplicaAutoScaling)
-> Generic UpdateTableReplicaAutoScaling
forall x.
Rep UpdateTableReplicaAutoScaling x
-> UpdateTableReplicaAutoScaling
forall x.
UpdateTableReplicaAutoScaling
-> Rep UpdateTableReplicaAutoScaling x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateTableReplicaAutoScaling x
-> UpdateTableReplicaAutoScaling
$cfrom :: forall x.
UpdateTableReplicaAutoScaling
-> Rep UpdateTableReplicaAutoScaling x
Prelude.Generic)

-- |
-- Create a value of 'UpdateTableReplicaAutoScaling' 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:
--
-- 'replicaUpdates', 'updateTableReplicaAutoScaling_replicaUpdates' - Represents the auto scaling settings of replicas of the table that will
-- be modified.
--
-- 'provisionedWriteCapacityAutoScalingUpdate', 'updateTableReplicaAutoScaling_provisionedWriteCapacityAutoScalingUpdate' - Undocumented member.
--
-- 'globalSecondaryIndexUpdates', 'updateTableReplicaAutoScaling_globalSecondaryIndexUpdates' - Represents the auto scaling settings of the global secondary indexes of
-- the replica to be updated.
--
-- 'tableName', 'updateTableReplicaAutoScaling_tableName' - The name of the global table to be updated.
newUpdateTableReplicaAutoScaling ::
  -- | 'tableName'
  Prelude.Text ->
  UpdateTableReplicaAutoScaling
newUpdateTableReplicaAutoScaling :: Text -> UpdateTableReplicaAutoScaling
newUpdateTableReplicaAutoScaling Text
pTableName_ =
  UpdateTableReplicaAutoScaling' :: Maybe (NonEmpty ReplicaAutoScalingUpdate)
-> Maybe AutoScalingSettingsUpdate
-> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
-> Text
-> UpdateTableReplicaAutoScaling
UpdateTableReplicaAutoScaling'
    { $sel:replicaUpdates:UpdateTableReplicaAutoScaling' :: Maybe (NonEmpty ReplicaAutoScalingUpdate)
replicaUpdates =
        Maybe (NonEmpty ReplicaAutoScalingUpdate)
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedWriteCapacityAutoScalingUpdate:UpdateTableReplicaAutoScaling' :: Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate =
        Maybe AutoScalingSettingsUpdate
forall a. Maybe a
Prelude.Nothing,
      $sel:globalSecondaryIndexUpdates:UpdateTableReplicaAutoScaling' :: Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
globalSecondaryIndexUpdates =
        Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:UpdateTableReplicaAutoScaling' :: Text
tableName = Text
pTableName_
    }

-- | Represents the auto scaling settings of replicas of the table that will
-- be modified.
updateTableReplicaAutoScaling_replicaUpdates :: Lens.Lens' UpdateTableReplicaAutoScaling (Prelude.Maybe (Prelude.NonEmpty ReplicaAutoScalingUpdate))
updateTableReplicaAutoScaling_replicaUpdates :: (Maybe (NonEmpty ReplicaAutoScalingUpdate)
 -> f (Maybe (NonEmpty ReplicaAutoScalingUpdate)))
-> UpdateTableReplicaAutoScaling -> f UpdateTableReplicaAutoScaling
updateTableReplicaAutoScaling_replicaUpdates = (UpdateTableReplicaAutoScaling
 -> Maybe (NonEmpty ReplicaAutoScalingUpdate))
-> (UpdateTableReplicaAutoScaling
    -> Maybe (NonEmpty ReplicaAutoScalingUpdate)
    -> UpdateTableReplicaAutoScaling)
-> Lens
     UpdateTableReplicaAutoScaling
     UpdateTableReplicaAutoScaling
     (Maybe (NonEmpty ReplicaAutoScalingUpdate))
     (Maybe (NonEmpty ReplicaAutoScalingUpdate))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTableReplicaAutoScaling' {Maybe (NonEmpty ReplicaAutoScalingUpdate)
replicaUpdates :: Maybe (NonEmpty ReplicaAutoScalingUpdate)
$sel:replicaUpdates:UpdateTableReplicaAutoScaling' :: UpdateTableReplicaAutoScaling
-> Maybe (NonEmpty ReplicaAutoScalingUpdate)
replicaUpdates} -> Maybe (NonEmpty ReplicaAutoScalingUpdate)
replicaUpdates) (\s :: UpdateTableReplicaAutoScaling
s@UpdateTableReplicaAutoScaling' {} Maybe (NonEmpty ReplicaAutoScalingUpdate)
a -> UpdateTableReplicaAutoScaling
s {$sel:replicaUpdates:UpdateTableReplicaAutoScaling' :: Maybe (NonEmpty ReplicaAutoScalingUpdate)
replicaUpdates = Maybe (NonEmpty ReplicaAutoScalingUpdate)
a} :: UpdateTableReplicaAutoScaling) ((Maybe (NonEmpty ReplicaAutoScalingUpdate)
  -> f (Maybe (NonEmpty ReplicaAutoScalingUpdate)))
 -> UpdateTableReplicaAutoScaling
 -> f UpdateTableReplicaAutoScaling)
-> ((Maybe (NonEmpty ReplicaAutoScalingUpdate)
     -> f (Maybe (NonEmpty ReplicaAutoScalingUpdate)))
    -> Maybe (NonEmpty ReplicaAutoScalingUpdate)
    -> f (Maybe (NonEmpty ReplicaAutoScalingUpdate)))
-> (Maybe (NonEmpty ReplicaAutoScalingUpdate)
    -> f (Maybe (NonEmpty ReplicaAutoScalingUpdate)))
-> UpdateTableReplicaAutoScaling
-> f UpdateTableReplicaAutoScaling
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ReplicaAutoScalingUpdate)
  (NonEmpty ReplicaAutoScalingUpdate)
  (NonEmpty ReplicaAutoScalingUpdate)
  (NonEmpty ReplicaAutoScalingUpdate)
-> Iso
     (Maybe (NonEmpty ReplicaAutoScalingUpdate))
     (Maybe (NonEmpty ReplicaAutoScalingUpdate))
     (Maybe (NonEmpty ReplicaAutoScalingUpdate))
     (Maybe (NonEmpty ReplicaAutoScalingUpdate))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty ReplicaAutoScalingUpdate)
  (NonEmpty ReplicaAutoScalingUpdate)
  (NonEmpty ReplicaAutoScalingUpdate)
  (NonEmpty ReplicaAutoScalingUpdate)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
updateTableReplicaAutoScaling_provisionedWriteCapacityAutoScalingUpdate :: Lens.Lens' UpdateTableReplicaAutoScaling (Prelude.Maybe AutoScalingSettingsUpdate)
updateTableReplicaAutoScaling_provisionedWriteCapacityAutoScalingUpdate :: (Maybe AutoScalingSettingsUpdate
 -> f (Maybe AutoScalingSettingsUpdate))
-> UpdateTableReplicaAutoScaling -> f UpdateTableReplicaAutoScaling
updateTableReplicaAutoScaling_provisionedWriteCapacityAutoScalingUpdate = (UpdateTableReplicaAutoScaling -> Maybe AutoScalingSettingsUpdate)
-> (UpdateTableReplicaAutoScaling
    -> Maybe AutoScalingSettingsUpdate
    -> UpdateTableReplicaAutoScaling)
-> Lens
     UpdateTableReplicaAutoScaling
     UpdateTableReplicaAutoScaling
     (Maybe AutoScalingSettingsUpdate)
     (Maybe AutoScalingSettingsUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTableReplicaAutoScaling' {Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
$sel:provisionedWriteCapacityAutoScalingUpdate:UpdateTableReplicaAutoScaling' :: UpdateTableReplicaAutoScaling -> Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate} -> Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate) (\s :: UpdateTableReplicaAutoScaling
s@UpdateTableReplicaAutoScaling' {} Maybe AutoScalingSettingsUpdate
a -> UpdateTableReplicaAutoScaling
s {$sel:provisionedWriteCapacityAutoScalingUpdate:UpdateTableReplicaAutoScaling' :: Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate = Maybe AutoScalingSettingsUpdate
a} :: UpdateTableReplicaAutoScaling)

-- | Represents the auto scaling settings of the global secondary indexes of
-- the replica to be updated.
updateTableReplicaAutoScaling_globalSecondaryIndexUpdates :: Lens.Lens' UpdateTableReplicaAutoScaling (Prelude.Maybe (Prelude.NonEmpty GlobalSecondaryIndexAutoScalingUpdate))
updateTableReplicaAutoScaling_globalSecondaryIndexUpdates :: (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
 -> f (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)))
-> UpdateTableReplicaAutoScaling -> f UpdateTableReplicaAutoScaling
updateTableReplicaAutoScaling_globalSecondaryIndexUpdates = (UpdateTableReplicaAutoScaling
 -> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate))
-> (UpdateTableReplicaAutoScaling
    -> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
    -> UpdateTableReplicaAutoScaling)
-> Lens
     UpdateTableReplicaAutoScaling
     UpdateTableReplicaAutoScaling
     (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate))
     (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTableReplicaAutoScaling' {Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
globalSecondaryIndexUpdates :: Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
$sel:globalSecondaryIndexUpdates:UpdateTableReplicaAutoScaling' :: UpdateTableReplicaAutoScaling
-> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
globalSecondaryIndexUpdates} -> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
globalSecondaryIndexUpdates) (\s :: UpdateTableReplicaAutoScaling
s@UpdateTableReplicaAutoScaling' {} Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
a -> UpdateTableReplicaAutoScaling
s {$sel:globalSecondaryIndexUpdates:UpdateTableReplicaAutoScaling' :: Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
globalSecondaryIndexUpdates = Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
a} :: UpdateTableReplicaAutoScaling) ((Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
  -> f (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)))
 -> UpdateTableReplicaAutoScaling
 -> f UpdateTableReplicaAutoScaling)
-> ((Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
     -> f (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)))
    -> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
    -> f (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)))
-> (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
    -> f (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)))
-> UpdateTableReplicaAutoScaling
-> f UpdateTableReplicaAutoScaling
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
  (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
  (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
  (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
-> Iso
     (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate))
     (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate))
     (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate))
     (Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
  (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
  (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
  (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the global table to be updated.
updateTableReplicaAutoScaling_tableName :: Lens.Lens' UpdateTableReplicaAutoScaling Prelude.Text
updateTableReplicaAutoScaling_tableName :: (Text -> f Text)
-> UpdateTableReplicaAutoScaling -> f UpdateTableReplicaAutoScaling
updateTableReplicaAutoScaling_tableName = (UpdateTableReplicaAutoScaling -> Text)
-> (UpdateTableReplicaAutoScaling
    -> Text -> UpdateTableReplicaAutoScaling)
-> Lens
     UpdateTableReplicaAutoScaling
     UpdateTableReplicaAutoScaling
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTableReplicaAutoScaling' {Text
tableName :: Text
$sel:tableName:UpdateTableReplicaAutoScaling' :: UpdateTableReplicaAutoScaling -> Text
tableName} -> Text
tableName) (\s :: UpdateTableReplicaAutoScaling
s@UpdateTableReplicaAutoScaling' {} Text
a -> UpdateTableReplicaAutoScaling
s {$sel:tableName:UpdateTableReplicaAutoScaling' :: Text
tableName = Text
a} :: UpdateTableReplicaAutoScaling)

instance
  Core.AWSRequest
    UpdateTableReplicaAutoScaling
  where
  type
    AWSResponse UpdateTableReplicaAutoScaling =
      UpdateTableReplicaAutoScalingResponse
  request :: UpdateTableReplicaAutoScaling
-> Request UpdateTableReplicaAutoScaling
request = Service
-> UpdateTableReplicaAutoScaling
-> Request UpdateTableReplicaAutoScaling
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateTableReplicaAutoScaling
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateTableReplicaAutoScaling)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateTableReplicaAutoScaling))
-> Logger
-> Service
-> Proxy UpdateTableReplicaAutoScaling
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateTableReplicaAutoScaling)))
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 -> UpdateTableReplicaAutoScalingResponse
UpdateTableReplicaAutoScalingResponse'
            (Maybe TableAutoScalingDescription
 -> Int -> UpdateTableReplicaAutoScalingResponse)
-> Either String (Maybe TableAutoScalingDescription)
-> Either String (Int -> UpdateTableReplicaAutoScalingResponse)
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 -> UpdateTableReplicaAutoScalingResponse)
-> Either String Int
-> Either String UpdateTableReplicaAutoScalingResponse
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
    UpdateTableReplicaAutoScaling

instance Prelude.NFData UpdateTableReplicaAutoScaling

instance Core.ToHeaders UpdateTableReplicaAutoScaling where
  toHeaders :: UpdateTableReplicaAutoScaling -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateTableReplicaAutoScaling -> 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.UpdateTableReplicaAutoScaling" ::
                          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 UpdateTableReplicaAutoScaling where
  toJSON :: UpdateTableReplicaAutoScaling -> Value
toJSON UpdateTableReplicaAutoScaling' {Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
Maybe (NonEmpty ReplicaAutoScalingUpdate)
Maybe AutoScalingSettingsUpdate
Text
tableName :: Text
globalSecondaryIndexUpdates :: Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
provisionedWriteCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
replicaUpdates :: Maybe (NonEmpty ReplicaAutoScalingUpdate)
$sel:tableName:UpdateTableReplicaAutoScaling' :: UpdateTableReplicaAutoScaling -> Text
$sel:globalSecondaryIndexUpdates:UpdateTableReplicaAutoScaling' :: UpdateTableReplicaAutoScaling
-> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
$sel:provisionedWriteCapacityAutoScalingUpdate:UpdateTableReplicaAutoScaling' :: UpdateTableReplicaAutoScaling -> Maybe AutoScalingSettingsUpdate
$sel:replicaUpdates:UpdateTableReplicaAutoScaling' :: UpdateTableReplicaAutoScaling
-> Maybe (NonEmpty ReplicaAutoScalingUpdate)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ReplicaUpdates" Text -> NonEmpty ReplicaAutoScalingUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty ReplicaAutoScalingUpdate -> Pair)
-> Maybe (NonEmpty ReplicaAutoScalingUpdate) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ReplicaAutoScalingUpdate)
replicaUpdates,
            (Text
"ProvisionedWriteCapacityAutoScalingUpdate" Text -> AutoScalingSettingsUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AutoScalingSettingsUpdate -> Pair)
-> Maybe AutoScalingSettingsUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate,
            (Text
"GlobalSecondaryIndexUpdates" Text -> NonEmpty GlobalSecondaryIndexAutoScalingUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty GlobalSecondaryIndexAutoScalingUpdate -> Pair)
-> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty GlobalSecondaryIndexAutoScalingUpdate)
globalSecondaryIndexUpdates,
            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 UpdateTableReplicaAutoScaling where
  toPath :: UpdateTableReplicaAutoScaling -> ByteString
toPath = ByteString -> UpdateTableReplicaAutoScaling -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'UpdateTableReplicaAutoScalingResponse' 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', 'updateTableReplicaAutoScalingResponse_tableAutoScalingDescription' - Returns information about the auto scaling settings of a table with
-- replicas.
--
-- 'httpStatus', 'updateTableReplicaAutoScalingResponse_httpStatus' - The response's http status code.
newUpdateTableReplicaAutoScalingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateTableReplicaAutoScalingResponse
newUpdateTableReplicaAutoScalingResponse :: Int -> UpdateTableReplicaAutoScalingResponse
newUpdateTableReplicaAutoScalingResponse Int
pHttpStatus_ =
  UpdateTableReplicaAutoScalingResponse' :: Maybe TableAutoScalingDescription
-> Int -> UpdateTableReplicaAutoScalingResponse
UpdateTableReplicaAutoScalingResponse'
    { $sel:tableAutoScalingDescription:UpdateTableReplicaAutoScalingResponse' :: Maybe TableAutoScalingDescription
tableAutoScalingDescription =
        Maybe TableAutoScalingDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateTableReplicaAutoScalingResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Returns information about the auto scaling settings of a table with
-- replicas.
updateTableReplicaAutoScalingResponse_tableAutoScalingDescription :: Lens.Lens' UpdateTableReplicaAutoScalingResponse (Prelude.Maybe TableAutoScalingDescription)
updateTableReplicaAutoScalingResponse_tableAutoScalingDescription :: (Maybe TableAutoScalingDescription
 -> f (Maybe TableAutoScalingDescription))
-> UpdateTableReplicaAutoScalingResponse
-> f UpdateTableReplicaAutoScalingResponse
updateTableReplicaAutoScalingResponse_tableAutoScalingDescription = (UpdateTableReplicaAutoScalingResponse
 -> Maybe TableAutoScalingDescription)
-> (UpdateTableReplicaAutoScalingResponse
    -> Maybe TableAutoScalingDescription
    -> UpdateTableReplicaAutoScalingResponse)
-> Lens
     UpdateTableReplicaAutoScalingResponse
     UpdateTableReplicaAutoScalingResponse
     (Maybe TableAutoScalingDescription)
     (Maybe TableAutoScalingDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTableReplicaAutoScalingResponse' {Maybe TableAutoScalingDescription
tableAutoScalingDescription :: Maybe TableAutoScalingDescription
$sel:tableAutoScalingDescription:UpdateTableReplicaAutoScalingResponse' :: UpdateTableReplicaAutoScalingResponse
-> Maybe TableAutoScalingDescription
tableAutoScalingDescription} -> Maybe TableAutoScalingDescription
tableAutoScalingDescription) (\s :: UpdateTableReplicaAutoScalingResponse
s@UpdateTableReplicaAutoScalingResponse' {} Maybe TableAutoScalingDescription
a -> UpdateTableReplicaAutoScalingResponse
s {$sel:tableAutoScalingDescription:UpdateTableReplicaAutoScalingResponse' :: Maybe TableAutoScalingDescription
tableAutoScalingDescription = Maybe TableAutoScalingDescription
a} :: UpdateTableReplicaAutoScalingResponse)

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

instance
  Prelude.NFData
    UpdateTableReplicaAutoScalingResponse