{-# 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.UpdateGlobalTableSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates settings for a global table.
module Amazonka.DynamoDB.UpdateGlobalTableSettings
  ( -- * Creating a Request
    UpdateGlobalTableSettings (..),
    newUpdateGlobalTableSettings,

    -- * Request Lenses
    updateGlobalTableSettings_globalTableBillingMode,
    updateGlobalTableSettings_globalTableGlobalSecondaryIndexSettingsUpdate,
    updateGlobalTableSettings_globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate,
    updateGlobalTableSettings_globalTableProvisionedWriteCapacityUnits,
    updateGlobalTableSettings_replicaSettingsUpdate,
    updateGlobalTableSettings_globalTableName,

    -- * Destructuring the Response
    UpdateGlobalTableSettingsResponse (..),
    newUpdateGlobalTableSettingsResponse,

    -- * Response Lenses
    updateGlobalTableSettingsResponse_globalTableName,
    updateGlobalTableSettingsResponse_replicaSettings,
    updateGlobalTableSettingsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateGlobalTableSettings' smart constructor.
data UpdateGlobalTableSettings = UpdateGlobalTableSettings'
  { -- | The billing mode of the global table. If @GlobalTableBillingMode@ is not
    -- specified, the global table defaults to @PROVISIONED@ capacity billing
    -- mode.
    --
    -- -   @PROVISIONED@ - We recommend using @PROVISIONED@ for predictable
    --     workloads. @PROVISIONED@ sets the billing mode to
    --     <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.ProvisionedThroughput.Manual Provisioned Mode>.
    --
    -- -   @PAY_PER_REQUEST@ - We recommend using @PAY_PER_REQUEST@ for
    --     unpredictable workloads. @PAY_PER_REQUEST@ sets the billing mode to
    --     <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.OnDemand On-Demand Mode>.
    UpdateGlobalTableSettings -> Maybe BillingMode
globalTableBillingMode :: Prelude.Maybe BillingMode,
    -- | Represents the settings of a global secondary index for a global table
    -- that will be modified.
    UpdateGlobalTableSettings
-> Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate :: Prelude.Maybe (Prelude.NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate),
    -- | Auto scaling settings for managing provisioned write capacity for the
    -- global table.
    UpdateGlobalTableSettings -> Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate :: Prelude.Maybe AutoScalingSettingsUpdate,
    -- | The maximum number of writes consumed per second before DynamoDB returns
    -- a @ThrottlingException.@
    UpdateGlobalTableSettings -> Maybe Natural
globalTableProvisionedWriteCapacityUnits :: Prelude.Maybe Prelude.Natural,
    -- | Represents the settings for a global table in a Region that will be
    -- modified.
    UpdateGlobalTableSettings -> Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate :: Prelude.Maybe (Prelude.NonEmpty ReplicaSettingsUpdate),
    -- | The name of the global table
    UpdateGlobalTableSettings -> Text
globalTableName :: Prelude.Text
  }
  deriving (UpdateGlobalTableSettings -> UpdateGlobalTableSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGlobalTableSettings -> UpdateGlobalTableSettings -> Bool
$c/= :: UpdateGlobalTableSettings -> UpdateGlobalTableSettings -> Bool
== :: UpdateGlobalTableSettings -> UpdateGlobalTableSettings -> Bool
$c== :: UpdateGlobalTableSettings -> UpdateGlobalTableSettings -> Bool
Prelude.Eq, ReadPrec [UpdateGlobalTableSettings]
ReadPrec UpdateGlobalTableSettings
Int -> ReadS UpdateGlobalTableSettings
ReadS [UpdateGlobalTableSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGlobalTableSettings]
$creadListPrec :: ReadPrec [UpdateGlobalTableSettings]
readPrec :: ReadPrec UpdateGlobalTableSettings
$creadPrec :: ReadPrec UpdateGlobalTableSettings
readList :: ReadS [UpdateGlobalTableSettings]
$creadList :: ReadS [UpdateGlobalTableSettings]
readsPrec :: Int -> ReadS UpdateGlobalTableSettings
$creadsPrec :: Int -> ReadS UpdateGlobalTableSettings
Prelude.Read, Int -> UpdateGlobalTableSettings -> ShowS
[UpdateGlobalTableSettings] -> ShowS
UpdateGlobalTableSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGlobalTableSettings] -> ShowS
$cshowList :: [UpdateGlobalTableSettings] -> ShowS
show :: UpdateGlobalTableSettings -> String
$cshow :: UpdateGlobalTableSettings -> String
showsPrec :: Int -> UpdateGlobalTableSettings -> ShowS
$cshowsPrec :: Int -> UpdateGlobalTableSettings -> ShowS
Prelude.Show, forall x.
Rep UpdateGlobalTableSettings x -> UpdateGlobalTableSettings
forall x.
UpdateGlobalTableSettings -> Rep UpdateGlobalTableSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGlobalTableSettings x -> UpdateGlobalTableSettings
$cfrom :: forall x.
UpdateGlobalTableSettings -> Rep UpdateGlobalTableSettings x
Prelude.Generic)

-- |
-- Create a value of 'UpdateGlobalTableSettings' 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:
--
-- 'globalTableBillingMode', 'updateGlobalTableSettings_globalTableBillingMode' - The billing mode of the global table. If @GlobalTableBillingMode@ is not
-- specified, the global table defaults to @PROVISIONED@ capacity billing
-- mode.
--
-- -   @PROVISIONED@ - We recommend using @PROVISIONED@ for predictable
--     workloads. @PROVISIONED@ sets the billing mode to
--     <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.ProvisionedThroughput.Manual Provisioned Mode>.
--
-- -   @PAY_PER_REQUEST@ - We recommend using @PAY_PER_REQUEST@ for
--     unpredictable workloads. @PAY_PER_REQUEST@ sets the billing mode to
--     <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.OnDemand On-Demand Mode>.
--
-- 'globalTableGlobalSecondaryIndexSettingsUpdate', 'updateGlobalTableSettings_globalTableGlobalSecondaryIndexSettingsUpdate' - Represents the settings of a global secondary index for a global table
-- that will be modified.
--
-- 'globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate', 'updateGlobalTableSettings_globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate' - Auto scaling settings for managing provisioned write capacity for the
-- global table.
--
-- 'globalTableProvisionedWriteCapacityUnits', 'updateGlobalTableSettings_globalTableProvisionedWriteCapacityUnits' - The maximum number of writes consumed per second before DynamoDB returns
-- a @ThrottlingException.@
--
-- 'replicaSettingsUpdate', 'updateGlobalTableSettings_replicaSettingsUpdate' - Represents the settings for a global table in a Region that will be
-- modified.
--
-- 'globalTableName', 'updateGlobalTableSettings_globalTableName' - The name of the global table
newUpdateGlobalTableSettings ::
  -- | 'globalTableName'
  Prelude.Text ->
  UpdateGlobalTableSettings
newUpdateGlobalTableSettings :: Text -> UpdateGlobalTableSettings
newUpdateGlobalTableSettings Text
pGlobalTableName_ =
  UpdateGlobalTableSettings'
    { $sel:globalTableBillingMode:UpdateGlobalTableSettings' :: Maybe BillingMode
globalTableBillingMode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:globalTableGlobalSecondaryIndexSettingsUpdate:UpdateGlobalTableSettings' :: Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate:UpdateGlobalTableSettings' :: Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:globalTableProvisionedWriteCapacityUnits:UpdateGlobalTableSettings' :: Maybe Natural
globalTableProvisionedWriteCapacityUnits =
        forall a. Maybe a
Prelude.Nothing,
      $sel:replicaSettingsUpdate:UpdateGlobalTableSettings' :: Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:globalTableName:UpdateGlobalTableSettings' :: Text
globalTableName = Text
pGlobalTableName_
    }

-- | The billing mode of the global table. If @GlobalTableBillingMode@ is not
-- specified, the global table defaults to @PROVISIONED@ capacity billing
-- mode.
--
-- -   @PROVISIONED@ - We recommend using @PROVISIONED@ for predictable
--     workloads. @PROVISIONED@ sets the billing mode to
--     <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.ProvisionedThroughput.Manual Provisioned Mode>.
--
-- -   @PAY_PER_REQUEST@ - We recommend using @PAY_PER_REQUEST@ for
--     unpredictable workloads. @PAY_PER_REQUEST@ sets the billing mode to
--     <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.OnDemand On-Demand Mode>.
updateGlobalTableSettings_globalTableBillingMode :: Lens.Lens' UpdateGlobalTableSettings (Prelude.Maybe BillingMode)
updateGlobalTableSettings_globalTableBillingMode :: Lens' UpdateGlobalTableSettings (Maybe BillingMode)
updateGlobalTableSettings_globalTableBillingMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableSettings' {Maybe BillingMode
globalTableBillingMode :: Maybe BillingMode
$sel:globalTableBillingMode:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe BillingMode
globalTableBillingMode} -> Maybe BillingMode
globalTableBillingMode) (\s :: UpdateGlobalTableSettings
s@UpdateGlobalTableSettings' {} Maybe BillingMode
a -> UpdateGlobalTableSettings
s {$sel:globalTableBillingMode:UpdateGlobalTableSettings' :: Maybe BillingMode
globalTableBillingMode = Maybe BillingMode
a} :: UpdateGlobalTableSettings)

-- | Represents the settings of a global secondary index for a global table
-- that will be modified.
updateGlobalTableSettings_globalTableGlobalSecondaryIndexSettingsUpdate :: Lens.Lens' UpdateGlobalTableSettings (Prelude.Maybe (Prelude.NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate))
updateGlobalTableSettings_globalTableGlobalSecondaryIndexSettingsUpdate :: Lens'
  UpdateGlobalTableSettings
  (Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate))
updateGlobalTableSettings_globalTableGlobalSecondaryIndexSettingsUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableSettings' {Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate :: Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
$sel:globalTableGlobalSecondaryIndexSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings
-> Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate} -> Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate) (\s :: UpdateGlobalTableSettings
s@UpdateGlobalTableSettings' {} Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
a -> UpdateGlobalTableSettings
s {$sel:globalTableGlobalSecondaryIndexSettingsUpdate:UpdateGlobalTableSettings' :: Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate = Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
a} :: UpdateGlobalTableSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Auto scaling settings for managing provisioned write capacity for the
-- global table.
updateGlobalTableSettings_globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate :: Lens.Lens' UpdateGlobalTableSettings (Prelude.Maybe AutoScalingSettingsUpdate)
updateGlobalTableSettings_globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate :: Lens' UpdateGlobalTableSettings (Maybe AutoScalingSettingsUpdate)
updateGlobalTableSettings_globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableSettings' {Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate :: Maybe AutoScalingSettingsUpdate
$sel:globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate} -> Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate) (\s :: UpdateGlobalTableSettings
s@UpdateGlobalTableSettings' {} Maybe AutoScalingSettingsUpdate
a -> UpdateGlobalTableSettings
s {$sel:globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate:UpdateGlobalTableSettings' :: Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate = Maybe AutoScalingSettingsUpdate
a} :: UpdateGlobalTableSettings)

-- | The maximum number of writes consumed per second before DynamoDB returns
-- a @ThrottlingException.@
updateGlobalTableSettings_globalTableProvisionedWriteCapacityUnits :: Lens.Lens' UpdateGlobalTableSettings (Prelude.Maybe Prelude.Natural)
updateGlobalTableSettings_globalTableProvisionedWriteCapacityUnits :: Lens' UpdateGlobalTableSettings (Maybe Natural)
updateGlobalTableSettings_globalTableProvisionedWriteCapacityUnits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableSettings' {Maybe Natural
globalTableProvisionedWriteCapacityUnits :: Maybe Natural
$sel:globalTableProvisionedWriteCapacityUnits:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe Natural
globalTableProvisionedWriteCapacityUnits} -> Maybe Natural
globalTableProvisionedWriteCapacityUnits) (\s :: UpdateGlobalTableSettings
s@UpdateGlobalTableSettings' {} Maybe Natural
a -> UpdateGlobalTableSettings
s {$sel:globalTableProvisionedWriteCapacityUnits:UpdateGlobalTableSettings' :: Maybe Natural
globalTableProvisionedWriteCapacityUnits = Maybe Natural
a} :: UpdateGlobalTableSettings)

-- | Represents the settings for a global table in a Region that will be
-- modified.
updateGlobalTableSettings_replicaSettingsUpdate :: Lens.Lens' UpdateGlobalTableSettings (Prelude.Maybe (Prelude.NonEmpty ReplicaSettingsUpdate))
updateGlobalTableSettings_replicaSettingsUpdate :: Lens'
  UpdateGlobalTableSettings (Maybe (NonEmpty ReplicaSettingsUpdate))
updateGlobalTableSettings_replicaSettingsUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableSettings' {Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate :: Maybe (NonEmpty ReplicaSettingsUpdate)
$sel:replicaSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate} -> Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate) (\s :: UpdateGlobalTableSettings
s@UpdateGlobalTableSettings' {} Maybe (NonEmpty ReplicaSettingsUpdate)
a -> UpdateGlobalTableSettings
s {$sel:replicaSettingsUpdate:UpdateGlobalTableSettings' :: Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate = Maybe (NonEmpty ReplicaSettingsUpdate)
a} :: UpdateGlobalTableSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the global table
updateGlobalTableSettings_globalTableName :: Lens.Lens' UpdateGlobalTableSettings Prelude.Text
updateGlobalTableSettings_globalTableName :: Lens' UpdateGlobalTableSettings Text
updateGlobalTableSettings_globalTableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableSettings' {Text
globalTableName :: Text
$sel:globalTableName:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Text
globalTableName} -> Text
globalTableName) (\s :: UpdateGlobalTableSettings
s@UpdateGlobalTableSettings' {} Text
a -> UpdateGlobalTableSettings
s {$sel:globalTableName:UpdateGlobalTableSettings' :: Text
globalTableName = Text
a} :: UpdateGlobalTableSettings)

instance Core.AWSRequest UpdateGlobalTableSettings where
  type
    AWSResponse UpdateGlobalTableSettings =
      UpdateGlobalTableSettingsResponse
  request :: (Service -> Service)
-> UpdateGlobalTableSettings -> Request UpdateGlobalTableSettings
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 UpdateGlobalTableSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateGlobalTableSettings)))
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 Text
-> Maybe [ReplicaSettingsDescription]
-> Int
-> UpdateGlobalTableSettingsResponse
UpdateGlobalTableSettingsResponse'
            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
"GlobalTableName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ReplicaSettings"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            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 UpdateGlobalTableSettings where
  hashWithSalt :: Int -> UpdateGlobalTableSettings -> Int
hashWithSalt Int
_salt UpdateGlobalTableSettings' {Maybe Natural
Maybe (NonEmpty ReplicaSettingsUpdate)
Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
Maybe BillingMode
Maybe AutoScalingSettingsUpdate
Text
globalTableName :: Text
replicaSettingsUpdate :: Maybe (NonEmpty ReplicaSettingsUpdate)
globalTableProvisionedWriteCapacityUnits :: Maybe Natural
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate :: Maybe AutoScalingSettingsUpdate
globalTableGlobalSecondaryIndexSettingsUpdate :: Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableBillingMode :: Maybe BillingMode
$sel:globalTableName:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Text
$sel:replicaSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe (NonEmpty ReplicaSettingsUpdate)
$sel:globalTableProvisionedWriteCapacityUnits:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe Natural
$sel:globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe AutoScalingSettingsUpdate
$sel:globalTableGlobalSecondaryIndexSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings
-> Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
$sel:globalTableBillingMode:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe BillingMode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BillingMode
globalTableBillingMode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
globalTableProvisionedWriteCapacityUnits
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
globalTableName

instance Prelude.NFData UpdateGlobalTableSettings where
  rnf :: UpdateGlobalTableSettings -> ()
rnf UpdateGlobalTableSettings' {Maybe Natural
Maybe (NonEmpty ReplicaSettingsUpdate)
Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
Maybe BillingMode
Maybe AutoScalingSettingsUpdate
Text
globalTableName :: Text
replicaSettingsUpdate :: Maybe (NonEmpty ReplicaSettingsUpdate)
globalTableProvisionedWriteCapacityUnits :: Maybe Natural
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate :: Maybe AutoScalingSettingsUpdate
globalTableGlobalSecondaryIndexSettingsUpdate :: Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableBillingMode :: Maybe BillingMode
$sel:globalTableName:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Text
$sel:replicaSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe (NonEmpty ReplicaSettingsUpdate)
$sel:globalTableProvisionedWriteCapacityUnits:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe Natural
$sel:globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe AutoScalingSettingsUpdate
$sel:globalTableGlobalSecondaryIndexSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings
-> Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
$sel:globalTableBillingMode:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe BillingMode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BillingMode
globalTableBillingMode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
globalTableProvisionedWriteCapacityUnits
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
globalTableName

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

instance Data.ToJSON UpdateGlobalTableSettings where
  toJSON :: UpdateGlobalTableSettings -> Value
toJSON UpdateGlobalTableSettings' {Maybe Natural
Maybe (NonEmpty ReplicaSettingsUpdate)
Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
Maybe BillingMode
Maybe AutoScalingSettingsUpdate
Text
globalTableName :: Text
replicaSettingsUpdate :: Maybe (NonEmpty ReplicaSettingsUpdate)
globalTableProvisionedWriteCapacityUnits :: Maybe Natural
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate :: Maybe AutoScalingSettingsUpdate
globalTableGlobalSecondaryIndexSettingsUpdate :: Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableBillingMode :: Maybe BillingMode
$sel:globalTableName:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Text
$sel:replicaSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe (NonEmpty ReplicaSettingsUpdate)
$sel:globalTableProvisionedWriteCapacityUnits:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe Natural
$sel:globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe AutoScalingSettingsUpdate
$sel:globalTableGlobalSecondaryIndexSettingsUpdate:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings
-> Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
$sel:globalTableBillingMode:UpdateGlobalTableSettings' :: UpdateGlobalTableSettings -> Maybe BillingMode
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"GlobalTableBillingMode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BillingMode
globalTableBillingMode,
            ( Key
"GlobalTableGlobalSecondaryIndexSettingsUpdate"
                forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=
            )
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty GlobalTableGlobalSecondaryIndexSettingsUpdate)
globalTableGlobalSecondaryIndexSettingsUpdate,
            ( Key
"GlobalTableProvisionedWriteCapacityAutoScalingSettingsUpdate"
                forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=
            )
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoScalingSettingsUpdate
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate,
            (Key
"GlobalTableProvisionedWriteCapacityUnits" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
globalTableProvisionedWriteCapacityUnits,
            (Key
"ReplicaSettingsUpdate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ReplicaSettingsUpdate)
replicaSettingsUpdate,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"GlobalTableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
globalTableName)
          ]
      )

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

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

-- | /See:/ 'newUpdateGlobalTableSettingsResponse' smart constructor.
data UpdateGlobalTableSettingsResponse = UpdateGlobalTableSettingsResponse'
  { -- | The name of the global table.
    UpdateGlobalTableSettingsResponse -> Maybe Text
globalTableName :: Prelude.Maybe Prelude.Text,
    -- | The Region-specific settings for the global table.
    UpdateGlobalTableSettingsResponse
-> Maybe [ReplicaSettingsDescription]
replicaSettings :: Prelude.Maybe [ReplicaSettingsDescription],
    -- | The response's http status code.
    UpdateGlobalTableSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateGlobalTableSettingsResponse
-> UpdateGlobalTableSettingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGlobalTableSettingsResponse
-> UpdateGlobalTableSettingsResponse -> Bool
$c/= :: UpdateGlobalTableSettingsResponse
-> UpdateGlobalTableSettingsResponse -> Bool
== :: UpdateGlobalTableSettingsResponse
-> UpdateGlobalTableSettingsResponse -> Bool
$c== :: UpdateGlobalTableSettingsResponse
-> UpdateGlobalTableSettingsResponse -> Bool
Prelude.Eq, ReadPrec [UpdateGlobalTableSettingsResponse]
ReadPrec UpdateGlobalTableSettingsResponse
Int -> ReadS UpdateGlobalTableSettingsResponse
ReadS [UpdateGlobalTableSettingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGlobalTableSettingsResponse]
$creadListPrec :: ReadPrec [UpdateGlobalTableSettingsResponse]
readPrec :: ReadPrec UpdateGlobalTableSettingsResponse
$creadPrec :: ReadPrec UpdateGlobalTableSettingsResponse
readList :: ReadS [UpdateGlobalTableSettingsResponse]
$creadList :: ReadS [UpdateGlobalTableSettingsResponse]
readsPrec :: Int -> ReadS UpdateGlobalTableSettingsResponse
$creadsPrec :: Int -> ReadS UpdateGlobalTableSettingsResponse
Prelude.Read, Int -> UpdateGlobalTableSettingsResponse -> ShowS
[UpdateGlobalTableSettingsResponse] -> ShowS
UpdateGlobalTableSettingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGlobalTableSettingsResponse] -> ShowS
$cshowList :: [UpdateGlobalTableSettingsResponse] -> ShowS
show :: UpdateGlobalTableSettingsResponse -> String
$cshow :: UpdateGlobalTableSettingsResponse -> String
showsPrec :: Int -> UpdateGlobalTableSettingsResponse -> ShowS
$cshowsPrec :: Int -> UpdateGlobalTableSettingsResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateGlobalTableSettingsResponse x
-> UpdateGlobalTableSettingsResponse
forall x.
UpdateGlobalTableSettingsResponse
-> Rep UpdateGlobalTableSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGlobalTableSettingsResponse x
-> UpdateGlobalTableSettingsResponse
$cfrom :: forall x.
UpdateGlobalTableSettingsResponse
-> Rep UpdateGlobalTableSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateGlobalTableSettingsResponse' 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:
--
-- 'globalTableName', 'updateGlobalTableSettingsResponse_globalTableName' - The name of the global table.
--
-- 'replicaSettings', 'updateGlobalTableSettingsResponse_replicaSettings' - The Region-specific settings for the global table.
--
-- 'httpStatus', 'updateGlobalTableSettingsResponse_httpStatus' - The response's http status code.
newUpdateGlobalTableSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateGlobalTableSettingsResponse
newUpdateGlobalTableSettingsResponse :: Int -> UpdateGlobalTableSettingsResponse
newUpdateGlobalTableSettingsResponse Int
pHttpStatus_ =
  UpdateGlobalTableSettingsResponse'
    { $sel:globalTableName:UpdateGlobalTableSettingsResponse' :: Maybe Text
globalTableName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:replicaSettings:UpdateGlobalTableSettingsResponse' :: Maybe [ReplicaSettingsDescription]
replicaSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateGlobalTableSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The name of the global table.
updateGlobalTableSettingsResponse_globalTableName :: Lens.Lens' UpdateGlobalTableSettingsResponse (Prelude.Maybe Prelude.Text)
updateGlobalTableSettingsResponse_globalTableName :: Lens' UpdateGlobalTableSettingsResponse (Maybe Text)
updateGlobalTableSettingsResponse_globalTableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableSettingsResponse' {Maybe Text
globalTableName :: Maybe Text
$sel:globalTableName:UpdateGlobalTableSettingsResponse' :: UpdateGlobalTableSettingsResponse -> Maybe Text
globalTableName} -> Maybe Text
globalTableName) (\s :: UpdateGlobalTableSettingsResponse
s@UpdateGlobalTableSettingsResponse' {} Maybe Text
a -> UpdateGlobalTableSettingsResponse
s {$sel:globalTableName:UpdateGlobalTableSettingsResponse' :: Maybe Text
globalTableName = Maybe Text
a} :: UpdateGlobalTableSettingsResponse)

-- | The Region-specific settings for the global table.
updateGlobalTableSettingsResponse_replicaSettings :: Lens.Lens' UpdateGlobalTableSettingsResponse (Prelude.Maybe [ReplicaSettingsDescription])
updateGlobalTableSettingsResponse_replicaSettings :: Lens'
  UpdateGlobalTableSettingsResponse
  (Maybe [ReplicaSettingsDescription])
updateGlobalTableSettingsResponse_replicaSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalTableSettingsResponse' {Maybe [ReplicaSettingsDescription]
replicaSettings :: Maybe [ReplicaSettingsDescription]
$sel:replicaSettings:UpdateGlobalTableSettingsResponse' :: UpdateGlobalTableSettingsResponse
-> Maybe [ReplicaSettingsDescription]
replicaSettings} -> Maybe [ReplicaSettingsDescription]
replicaSettings) (\s :: UpdateGlobalTableSettingsResponse
s@UpdateGlobalTableSettingsResponse' {} Maybe [ReplicaSettingsDescription]
a -> UpdateGlobalTableSettingsResponse
s {$sel:replicaSettings:UpdateGlobalTableSettingsResponse' :: Maybe [ReplicaSettingsDescription]
replicaSettings = Maybe [ReplicaSettingsDescription]
a} :: UpdateGlobalTableSettingsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    UpdateGlobalTableSettingsResponse
  where
  rnf :: UpdateGlobalTableSettingsResponse -> ()
rnf UpdateGlobalTableSettingsResponse' {Int
Maybe [ReplicaSettingsDescription]
Maybe Text
httpStatus :: Int
replicaSettings :: Maybe [ReplicaSettingsDescription]
globalTableName :: Maybe Text
$sel:httpStatus:UpdateGlobalTableSettingsResponse' :: UpdateGlobalTableSettingsResponse -> Int
$sel:replicaSettings:UpdateGlobalTableSettingsResponse' :: UpdateGlobalTableSettingsResponse
-> Maybe [ReplicaSettingsDescription]
$sel:globalTableName:UpdateGlobalTableSettingsResponse' :: UpdateGlobalTableSettingsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
globalTableName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReplicaSettingsDescription]
replicaSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus