{-# 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.RestoreTableFromBackup
-- 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)
--
-- Creates a new table from an existing backup. Any number of users can
-- execute up to 4 concurrent restores (any type of restore) in a given
-- account.
--
-- You can call @RestoreTableFromBackup@ at a maximum rate of 10 times per
-- second.
--
-- You must manually set up the following on the restored table:
--
-- -   Auto scaling policies
--
-- -   IAM policies
--
-- -   Amazon CloudWatch metrics and alarms
--
-- -   Tags
--
-- -   Stream settings
--
-- -   Time to Live (TTL) settings
module Amazonka.DynamoDB.RestoreTableFromBackup
  ( -- * Creating a Request
    RestoreTableFromBackup (..),
    newRestoreTableFromBackup,

    -- * Request Lenses
    restoreTableFromBackup_billingModeOverride,
    restoreTableFromBackup_globalSecondaryIndexOverride,
    restoreTableFromBackup_provisionedThroughputOverride,
    restoreTableFromBackup_sSESpecificationOverride,
    restoreTableFromBackup_localSecondaryIndexOverride,
    restoreTableFromBackup_targetTableName,
    restoreTableFromBackup_backupArn,

    -- * Destructuring the Response
    RestoreTableFromBackupResponse (..),
    newRestoreTableFromBackupResponse,

    -- * Response Lenses
    restoreTableFromBackupResponse_tableDescription,
    restoreTableFromBackupResponse_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:/ 'newRestoreTableFromBackup' smart constructor.
data RestoreTableFromBackup = RestoreTableFromBackup'
  { -- | The billing mode of the restored table.
    RestoreTableFromBackup -> Maybe BillingMode
billingModeOverride :: Prelude.Maybe BillingMode,
    -- | List of global secondary indexes for the restored table. The indexes
    -- provided should match existing secondary indexes. You can choose to
    -- exclude some or all of the indexes at the time of restore.
    RestoreTableFromBackup -> Maybe [GlobalSecondaryIndex]
globalSecondaryIndexOverride :: Prelude.Maybe [GlobalSecondaryIndex],
    -- | Provisioned throughput settings for the restored table.
    RestoreTableFromBackup -> Maybe ProvisionedThroughput
provisionedThroughputOverride :: Prelude.Maybe ProvisionedThroughput,
    -- | The new server-side encryption settings for the restored table.
    RestoreTableFromBackup -> Maybe SSESpecification
sSESpecificationOverride :: Prelude.Maybe SSESpecification,
    -- | List of local secondary indexes for the restored table. The indexes
    -- provided should match existing secondary indexes. You can choose to
    -- exclude some or all of the indexes at the time of restore.
    RestoreTableFromBackup -> Maybe [LocalSecondaryIndex]
localSecondaryIndexOverride :: Prelude.Maybe [LocalSecondaryIndex],
    -- | The name of the new table to which the backup must be restored.
    RestoreTableFromBackup -> Text
targetTableName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) associated with the backup.
    RestoreTableFromBackup -> Text
backupArn :: Prelude.Text
  }
  deriving (RestoreTableFromBackup -> RestoreTableFromBackup -> Bool
(RestoreTableFromBackup -> RestoreTableFromBackup -> Bool)
-> (RestoreTableFromBackup -> RestoreTableFromBackup -> Bool)
-> Eq RestoreTableFromBackup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreTableFromBackup -> RestoreTableFromBackup -> Bool
$c/= :: RestoreTableFromBackup -> RestoreTableFromBackup -> Bool
== :: RestoreTableFromBackup -> RestoreTableFromBackup -> Bool
$c== :: RestoreTableFromBackup -> RestoreTableFromBackup -> Bool
Prelude.Eq, ReadPrec [RestoreTableFromBackup]
ReadPrec RestoreTableFromBackup
Int -> ReadS RestoreTableFromBackup
ReadS [RestoreTableFromBackup]
(Int -> ReadS RestoreTableFromBackup)
-> ReadS [RestoreTableFromBackup]
-> ReadPrec RestoreTableFromBackup
-> ReadPrec [RestoreTableFromBackup]
-> Read RestoreTableFromBackup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreTableFromBackup]
$creadListPrec :: ReadPrec [RestoreTableFromBackup]
readPrec :: ReadPrec RestoreTableFromBackup
$creadPrec :: ReadPrec RestoreTableFromBackup
readList :: ReadS [RestoreTableFromBackup]
$creadList :: ReadS [RestoreTableFromBackup]
readsPrec :: Int -> ReadS RestoreTableFromBackup
$creadsPrec :: Int -> ReadS RestoreTableFromBackup
Prelude.Read, Int -> RestoreTableFromBackup -> ShowS
[RestoreTableFromBackup] -> ShowS
RestoreTableFromBackup -> String
(Int -> RestoreTableFromBackup -> ShowS)
-> (RestoreTableFromBackup -> String)
-> ([RestoreTableFromBackup] -> ShowS)
-> Show RestoreTableFromBackup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreTableFromBackup] -> ShowS
$cshowList :: [RestoreTableFromBackup] -> ShowS
show :: RestoreTableFromBackup -> String
$cshow :: RestoreTableFromBackup -> String
showsPrec :: Int -> RestoreTableFromBackup -> ShowS
$cshowsPrec :: Int -> RestoreTableFromBackup -> ShowS
Prelude.Show, (forall x. RestoreTableFromBackup -> Rep RestoreTableFromBackup x)
-> (forall x.
    Rep RestoreTableFromBackup x -> RestoreTableFromBackup)
-> Generic RestoreTableFromBackup
forall x. Rep RestoreTableFromBackup x -> RestoreTableFromBackup
forall x. RestoreTableFromBackup -> Rep RestoreTableFromBackup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RestoreTableFromBackup x -> RestoreTableFromBackup
$cfrom :: forall x. RestoreTableFromBackup -> Rep RestoreTableFromBackup x
Prelude.Generic)

-- |
-- Create a value of 'RestoreTableFromBackup' 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:
--
-- 'billingModeOverride', 'restoreTableFromBackup_billingModeOverride' - The billing mode of the restored table.
--
-- 'globalSecondaryIndexOverride', 'restoreTableFromBackup_globalSecondaryIndexOverride' - List of global secondary indexes for the restored table. The indexes
-- provided should match existing secondary indexes. You can choose to
-- exclude some or all of the indexes at the time of restore.
--
-- 'provisionedThroughputOverride', 'restoreTableFromBackup_provisionedThroughputOverride' - Provisioned throughput settings for the restored table.
--
-- 'sSESpecificationOverride', 'restoreTableFromBackup_sSESpecificationOverride' - The new server-side encryption settings for the restored table.
--
-- 'localSecondaryIndexOverride', 'restoreTableFromBackup_localSecondaryIndexOverride' - List of local secondary indexes for the restored table. The indexes
-- provided should match existing secondary indexes. You can choose to
-- exclude some or all of the indexes at the time of restore.
--
-- 'targetTableName', 'restoreTableFromBackup_targetTableName' - The name of the new table to which the backup must be restored.
--
-- 'backupArn', 'restoreTableFromBackup_backupArn' - The Amazon Resource Name (ARN) associated with the backup.
newRestoreTableFromBackup ::
  -- | 'targetTableName'
  Prelude.Text ->
  -- | 'backupArn'
  Prelude.Text ->
  RestoreTableFromBackup
newRestoreTableFromBackup :: Text -> Text -> RestoreTableFromBackup
newRestoreTableFromBackup
  Text
pTargetTableName_
  Text
pBackupArn_ =
    RestoreTableFromBackup' :: Maybe BillingMode
-> Maybe [GlobalSecondaryIndex]
-> Maybe ProvisionedThroughput
-> Maybe SSESpecification
-> Maybe [LocalSecondaryIndex]
-> Text
-> Text
-> RestoreTableFromBackup
RestoreTableFromBackup'
      { $sel:billingModeOverride:RestoreTableFromBackup' :: Maybe BillingMode
billingModeOverride =
          Maybe BillingMode
forall a. Maybe a
Prelude.Nothing,
        $sel:globalSecondaryIndexOverride:RestoreTableFromBackup' :: Maybe [GlobalSecondaryIndex]
globalSecondaryIndexOverride = Maybe [GlobalSecondaryIndex]
forall a. Maybe a
Prelude.Nothing,
        $sel:provisionedThroughputOverride:RestoreTableFromBackup' :: Maybe ProvisionedThroughput
provisionedThroughputOverride = Maybe ProvisionedThroughput
forall a. Maybe a
Prelude.Nothing,
        $sel:sSESpecificationOverride:RestoreTableFromBackup' :: Maybe SSESpecification
sSESpecificationOverride = Maybe SSESpecification
forall a. Maybe a
Prelude.Nothing,
        $sel:localSecondaryIndexOverride:RestoreTableFromBackup' :: Maybe [LocalSecondaryIndex]
localSecondaryIndexOverride = Maybe [LocalSecondaryIndex]
forall a. Maybe a
Prelude.Nothing,
        $sel:targetTableName:RestoreTableFromBackup' :: Text
targetTableName = Text
pTargetTableName_,
        $sel:backupArn:RestoreTableFromBackup' :: Text
backupArn = Text
pBackupArn_
      }

-- | The billing mode of the restored table.
restoreTableFromBackup_billingModeOverride :: Lens.Lens' RestoreTableFromBackup (Prelude.Maybe BillingMode)
restoreTableFromBackup_billingModeOverride :: (Maybe BillingMode -> f (Maybe BillingMode))
-> RestoreTableFromBackup -> f RestoreTableFromBackup
restoreTableFromBackup_billingModeOverride = (RestoreTableFromBackup -> Maybe BillingMode)
-> (RestoreTableFromBackup
    -> Maybe BillingMode -> RestoreTableFromBackup)
-> Lens
     RestoreTableFromBackup
     RestoreTableFromBackup
     (Maybe BillingMode)
     (Maybe BillingMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromBackup' {Maybe BillingMode
billingModeOverride :: Maybe BillingMode
$sel:billingModeOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe BillingMode
billingModeOverride} -> Maybe BillingMode
billingModeOverride) (\s :: RestoreTableFromBackup
s@RestoreTableFromBackup' {} Maybe BillingMode
a -> RestoreTableFromBackup
s {$sel:billingModeOverride:RestoreTableFromBackup' :: Maybe BillingMode
billingModeOverride = Maybe BillingMode
a} :: RestoreTableFromBackup)

-- | List of global secondary indexes for the restored table. The indexes
-- provided should match existing secondary indexes. You can choose to
-- exclude some or all of the indexes at the time of restore.
restoreTableFromBackup_globalSecondaryIndexOverride :: Lens.Lens' RestoreTableFromBackup (Prelude.Maybe [GlobalSecondaryIndex])
restoreTableFromBackup_globalSecondaryIndexOverride :: (Maybe [GlobalSecondaryIndex] -> f (Maybe [GlobalSecondaryIndex]))
-> RestoreTableFromBackup -> f RestoreTableFromBackup
restoreTableFromBackup_globalSecondaryIndexOverride = (RestoreTableFromBackup -> Maybe [GlobalSecondaryIndex])
-> (RestoreTableFromBackup
    -> Maybe [GlobalSecondaryIndex] -> RestoreTableFromBackup)
-> Lens
     RestoreTableFromBackup
     RestoreTableFromBackup
     (Maybe [GlobalSecondaryIndex])
     (Maybe [GlobalSecondaryIndex])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromBackup' {Maybe [GlobalSecondaryIndex]
globalSecondaryIndexOverride :: Maybe [GlobalSecondaryIndex]
$sel:globalSecondaryIndexOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe [GlobalSecondaryIndex]
globalSecondaryIndexOverride} -> Maybe [GlobalSecondaryIndex]
globalSecondaryIndexOverride) (\s :: RestoreTableFromBackup
s@RestoreTableFromBackup' {} Maybe [GlobalSecondaryIndex]
a -> RestoreTableFromBackup
s {$sel:globalSecondaryIndexOverride:RestoreTableFromBackup' :: Maybe [GlobalSecondaryIndex]
globalSecondaryIndexOverride = Maybe [GlobalSecondaryIndex]
a} :: RestoreTableFromBackup) ((Maybe [GlobalSecondaryIndex] -> f (Maybe [GlobalSecondaryIndex]))
 -> RestoreTableFromBackup -> f RestoreTableFromBackup)
-> ((Maybe [GlobalSecondaryIndex]
     -> f (Maybe [GlobalSecondaryIndex]))
    -> Maybe [GlobalSecondaryIndex]
    -> f (Maybe [GlobalSecondaryIndex]))
-> (Maybe [GlobalSecondaryIndex]
    -> f (Maybe [GlobalSecondaryIndex]))
-> RestoreTableFromBackup
-> f RestoreTableFromBackup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GlobalSecondaryIndex]
  [GlobalSecondaryIndex]
  [GlobalSecondaryIndex]
  [GlobalSecondaryIndex]
-> Iso
     (Maybe [GlobalSecondaryIndex])
     (Maybe [GlobalSecondaryIndex])
     (Maybe [GlobalSecondaryIndex])
     (Maybe [GlobalSecondaryIndex])
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
  [GlobalSecondaryIndex]
  [GlobalSecondaryIndex]
  [GlobalSecondaryIndex]
  [GlobalSecondaryIndex]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Provisioned throughput settings for the restored table.
restoreTableFromBackup_provisionedThroughputOverride :: Lens.Lens' RestoreTableFromBackup (Prelude.Maybe ProvisionedThroughput)
restoreTableFromBackup_provisionedThroughputOverride :: (Maybe ProvisionedThroughput -> f (Maybe ProvisionedThroughput))
-> RestoreTableFromBackup -> f RestoreTableFromBackup
restoreTableFromBackup_provisionedThroughputOverride = (RestoreTableFromBackup -> Maybe ProvisionedThroughput)
-> (RestoreTableFromBackup
    -> Maybe ProvisionedThroughput -> RestoreTableFromBackup)
-> Lens
     RestoreTableFromBackup
     RestoreTableFromBackup
     (Maybe ProvisionedThroughput)
     (Maybe ProvisionedThroughput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromBackup' {Maybe ProvisionedThroughput
provisionedThroughputOverride :: Maybe ProvisionedThroughput
$sel:provisionedThroughputOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe ProvisionedThroughput
provisionedThroughputOverride} -> Maybe ProvisionedThroughput
provisionedThroughputOverride) (\s :: RestoreTableFromBackup
s@RestoreTableFromBackup' {} Maybe ProvisionedThroughput
a -> RestoreTableFromBackup
s {$sel:provisionedThroughputOverride:RestoreTableFromBackup' :: Maybe ProvisionedThroughput
provisionedThroughputOverride = Maybe ProvisionedThroughput
a} :: RestoreTableFromBackup)

-- | The new server-side encryption settings for the restored table.
restoreTableFromBackup_sSESpecificationOverride :: Lens.Lens' RestoreTableFromBackup (Prelude.Maybe SSESpecification)
restoreTableFromBackup_sSESpecificationOverride :: (Maybe SSESpecification -> f (Maybe SSESpecification))
-> RestoreTableFromBackup -> f RestoreTableFromBackup
restoreTableFromBackup_sSESpecificationOverride = (RestoreTableFromBackup -> Maybe SSESpecification)
-> (RestoreTableFromBackup
    -> Maybe SSESpecification -> RestoreTableFromBackup)
-> Lens
     RestoreTableFromBackup
     RestoreTableFromBackup
     (Maybe SSESpecification)
     (Maybe SSESpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromBackup' {Maybe SSESpecification
sSESpecificationOverride :: Maybe SSESpecification
$sel:sSESpecificationOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe SSESpecification
sSESpecificationOverride} -> Maybe SSESpecification
sSESpecificationOverride) (\s :: RestoreTableFromBackup
s@RestoreTableFromBackup' {} Maybe SSESpecification
a -> RestoreTableFromBackup
s {$sel:sSESpecificationOverride:RestoreTableFromBackup' :: Maybe SSESpecification
sSESpecificationOverride = Maybe SSESpecification
a} :: RestoreTableFromBackup)

-- | List of local secondary indexes for the restored table. The indexes
-- provided should match existing secondary indexes. You can choose to
-- exclude some or all of the indexes at the time of restore.
restoreTableFromBackup_localSecondaryIndexOverride :: Lens.Lens' RestoreTableFromBackup (Prelude.Maybe [LocalSecondaryIndex])
restoreTableFromBackup_localSecondaryIndexOverride :: (Maybe [LocalSecondaryIndex] -> f (Maybe [LocalSecondaryIndex]))
-> RestoreTableFromBackup -> f RestoreTableFromBackup
restoreTableFromBackup_localSecondaryIndexOverride = (RestoreTableFromBackup -> Maybe [LocalSecondaryIndex])
-> (RestoreTableFromBackup
    -> Maybe [LocalSecondaryIndex] -> RestoreTableFromBackup)
-> Lens
     RestoreTableFromBackup
     RestoreTableFromBackup
     (Maybe [LocalSecondaryIndex])
     (Maybe [LocalSecondaryIndex])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromBackup' {Maybe [LocalSecondaryIndex]
localSecondaryIndexOverride :: Maybe [LocalSecondaryIndex]
$sel:localSecondaryIndexOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe [LocalSecondaryIndex]
localSecondaryIndexOverride} -> Maybe [LocalSecondaryIndex]
localSecondaryIndexOverride) (\s :: RestoreTableFromBackup
s@RestoreTableFromBackup' {} Maybe [LocalSecondaryIndex]
a -> RestoreTableFromBackup
s {$sel:localSecondaryIndexOverride:RestoreTableFromBackup' :: Maybe [LocalSecondaryIndex]
localSecondaryIndexOverride = Maybe [LocalSecondaryIndex]
a} :: RestoreTableFromBackup) ((Maybe [LocalSecondaryIndex] -> f (Maybe [LocalSecondaryIndex]))
 -> RestoreTableFromBackup -> f RestoreTableFromBackup)
-> ((Maybe [LocalSecondaryIndex]
     -> f (Maybe [LocalSecondaryIndex]))
    -> Maybe [LocalSecondaryIndex] -> f (Maybe [LocalSecondaryIndex]))
-> (Maybe [LocalSecondaryIndex] -> f (Maybe [LocalSecondaryIndex]))
-> RestoreTableFromBackup
-> f RestoreTableFromBackup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LocalSecondaryIndex]
  [LocalSecondaryIndex]
  [LocalSecondaryIndex]
  [LocalSecondaryIndex]
-> Iso
     (Maybe [LocalSecondaryIndex])
     (Maybe [LocalSecondaryIndex])
     (Maybe [LocalSecondaryIndex])
     (Maybe [LocalSecondaryIndex])
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
  [LocalSecondaryIndex]
  [LocalSecondaryIndex]
  [LocalSecondaryIndex]
  [LocalSecondaryIndex]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the new table to which the backup must be restored.
restoreTableFromBackup_targetTableName :: Lens.Lens' RestoreTableFromBackup Prelude.Text
restoreTableFromBackup_targetTableName :: (Text -> f Text)
-> RestoreTableFromBackup -> f RestoreTableFromBackup
restoreTableFromBackup_targetTableName = (RestoreTableFromBackup -> Text)
-> (RestoreTableFromBackup -> Text -> RestoreTableFromBackup)
-> Lens RestoreTableFromBackup RestoreTableFromBackup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromBackup' {Text
targetTableName :: Text
$sel:targetTableName:RestoreTableFromBackup' :: RestoreTableFromBackup -> Text
targetTableName} -> Text
targetTableName) (\s :: RestoreTableFromBackup
s@RestoreTableFromBackup' {} Text
a -> RestoreTableFromBackup
s {$sel:targetTableName:RestoreTableFromBackup' :: Text
targetTableName = Text
a} :: RestoreTableFromBackup)

-- | The Amazon Resource Name (ARN) associated with the backup.
restoreTableFromBackup_backupArn :: Lens.Lens' RestoreTableFromBackup Prelude.Text
restoreTableFromBackup_backupArn :: (Text -> f Text)
-> RestoreTableFromBackup -> f RestoreTableFromBackup
restoreTableFromBackup_backupArn = (RestoreTableFromBackup -> Text)
-> (RestoreTableFromBackup -> Text -> RestoreTableFromBackup)
-> Lens RestoreTableFromBackup RestoreTableFromBackup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromBackup' {Text
backupArn :: Text
$sel:backupArn:RestoreTableFromBackup' :: RestoreTableFromBackup -> Text
backupArn} -> Text
backupArn) (\s :: RestoreTableFromBackup
s@RestoreTableFromBackup' {} Text
a -> RestoreTableFromBackup
s {$sel:backupArn:RestoreTableFromBackup' :: Text
backupArn = Text
a} :: RestoreTableFromBackup)

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

instance Prelude.NFData RestoreTableFromBackup

instance Core.ToHeaders RestoreTableFromBackup where
  toHeaders :: RestoreTableFromBackup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RestoreTableFromBackup -> 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.RestoreTableFromBackup" ::
                          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 RestoreTableFromBackup where
  toJSON :: RestoreTableFromBackup -> Value
toJSON RestoreTableFromBackup' {Maybe [LocalSecondaryIndex]
Maybe [GlobalSecondaryIndex]
Maybe BillingMode
Maybe ProvisionedThroughput
Maybe SSESpecification
Text
backupArn :: Text
targetTableName :: Text
localSecondaryIndexOverride :: Maybe [LocalSecondaryIndex]
sSESpecificationOverride :: Maybe SSESpecification
provisionedThroughputOverride :: Maybe ProvisionedThroughput
globalSecondaryIndexOverride :: Maybe [GlobalSecondaryIndex]
billingModeOverride :: Maybe BillingMode
$sel:backupArn:RestoreTableFromBackup' :: RestoreTableFromBackup -> Text
$sel:targetTableName:RestoreTableFromBackup' :: RestoreTableFromBackup -> Text
$sel:localSecondaryIndexOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe [LocalSecondaryIndex]
$sel:sSESpecificationOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe SSESpecification
$sel:provisionedThroughputOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe ProvisionedThroughput
$sel:globalSecondaryIndexOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe [GlobalSecondaryIndex]
$sel:billingModeOverride:RestoreTableFromBackup' :: RestoreTableFromBackup -> Maybe BillingMode
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"BillingModeOverride" Text -> BillingMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (BillingMode -> Pair) -> Maybe BillingMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BillingMode
billingModeOverride,
            (Text
"GlobalSecondaryIndexOverride" Text -> [GlobalSecondaryIndex] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([GlobalSecondaryIndex] -> Pair)
-> Maybe [GlobalSecondaryIndex] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [GlobalSecondaryIndex]
globalSecondaryIndexOverride,
            (Text
"ProvisionedThroughputOverride" Text -> ProvisionedThroughput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ProvisionedThroughput -> Pair)
-> Maybe ProvisionedThroughput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProvisionedThroughput
provisionedThroughputOverride,
            (Text
"SSESpecificationOverride" Text -> SSESpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SSESpecification -> Pair) -> Maybe SSESpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SSESpecification
sSESpecificationOverride,
            (Text
"LocalSecondaryIndexOverride" Text -> [LocalSecondaryIndex] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([LocalSecondaryIndex] -> Pair)
-> Maybe [LocalSecondaryIndex] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [LocalSecondaryIndex]
localSecondaryIndexOverride,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"TargetTableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetTableName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BackupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
backupArn)
          ]
      )

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

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

-- | /See:/ 'newRestoreTableFromBackupResponse' smart constructor.
data RestoreTableFromBackupResponse = RestoreTableFromBackupResponse'
  { -- | The description of the table created from an existing backup.
    RestoreTableFromBackupResponse -> Maybe TableDescription
tableDescription :: Prelude.Maybe TableDescription,
    -- | The response's http status code.
    RestoreTableFromBackupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RestoreTableFromBackupResponse
-> RestoreTableFromBackupResponse -> Bool
(RestoreTableFromBackupResponse
 -> RestoreTableFromBackupResponse -> Bool)
-> (RestoreTableFromBackupResponse
    -> RestoreTableFromBackupResponse -> Bool)
-> Eq RestoreTableFromBackupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreTableFromBackupResponse
-> RestoreTableFromBackupResponse -> Bool
$c/= :: RestoreTableFromBackupResponse
-> RestoreTableFromBackupResponse -> Bool
== :: RestoreTableFromBackupResponse
-> RestoreTableFromBackupResponse -> Bool
$c== :: RestoreTableFromBackupResponse
-> RestoreTableFromBackupResponse -> Bool
Prelude.Eq, ReadPrec [RestoreTableFromBackupResponse]
ReadPrec RestoreTableFromBackupResponse
Int -> ReadS RestoreTableFromBackupResponse
ReadS [RestoreTableFromBackupResponse]
(Int -> ReadS RestoreTableFromBackupResponse)
-> ReadS [RestoreTableFromBackupResponse]
-> ReadPrec RestoreTableFromBackupResponse
-> ReadPrec [RestoreTableFromBackupResponse]
-> Read RestoreTableFromBackupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreTableFromBackupResponse]
$creadListPrec :: ReadPrec [RestoreTableFromBackupResponse]
readPrec :: ReadPrec RestoreTableFromBackupResponse
$creadPrec :: ReadPrec RestoreTableFromBackupResponse
readList :: ReadS [RestoreTableFromBackupResponse]
$creadList :: ReadS [RestoreTableFromBackupResponse]
readsPrec :: Int -> ReadS RestoreTableFromBackupResponse
$creadsPrec :: Int -> ReadS RestoreTableFromBackupResponse
Prelude.Read, Int -> RestoreTableFromBackupResponse -> ShowS
[RestoreTableFromBackupResponse] -> ShowS
RestoreTableFromBackupResponse -> String
(Int -> RestoreTableFromBackupResponse -> ShowS)
-> (RestoreTableFromBackupResponse -> String)
-> ([RestoreTableFromBackupResponse] -> ShowS)
-> Show RestoreTableFromBackupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreTableFromBackupResponse] -> ShowS
$cshowList :: [RestoreTableFromBackupResponse] -> ShowS
show :: RestoreTableFromBackupResponse -> String
$cshow :: RestoreTableFromBackupResponse -> String
showsPrec :: Int -> RestoreTableFromBackupResponse -> ShowS
$cshowsPrec :: Int -> RestoreTableFromBackupResponse -> ShowS
Prelude.Show, (forall x.
 RestoreTableFromBackupResponse
 -> Rep RestoreTableFromBackupResponse x)
-> (forall x.
    Rep RestoreTableFromBackupResponse x
    -> RestoreTableFromBackupResponse)
-> Generic RestoreTableFromBackupResponse
forall x.
Rep RestoreTableFromBackupResponse x
-> RestoreTableFromBackupResponse
forall x.
RestoreTableFromBackupResponse
-> Rep RestoreTableFromBackupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RestoreTableFromBackupResponse x
-> RestoreTableFromBackupResponse
$cfrom :: forall x.
RestoreTableFromBackupResponse
-> Rep RestoreTableFromBackupResponse x
Prelude.Generic)

-- |
-- Create a value of 'RestoreTableFromBackupResponse' 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:
--
-- 'tableDescription', 'restoreTableFromBackupResponse_tableDescription' - The description of the table created from an existing backup.
--
-- 'httpStatus', 'restoreTableFromBackupResponse_httpStatus' - The response's http status code.
newRestoreTableFromBackupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RestoreTableFromBackupResponse
newRestoreTableFromBackupResponse :: Int -> RestoreTableFromBackupResponse
newRestoreTableFromBackupResponse Int
pHttpStatus_ =
  RestoreTableFromBackupResponse' :: Maybe TableDescription -> Int -> RestoreTableFromBackupResponse
RestoreTableFromBackupResponse'
    { $sel:tableDescription:RestoreTableFromBackupResponse' :: Maybe TableDescription
tableDescription =
        Maybe TableDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RestoreTableFromBackupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The description of the table created from an existing backup.
restoreTableFromBackupResponse_tableDescription :: Lens.Lens' RestoreTableFromBackupResponse (Prelude.Maybe TableDescription)
restoreTableFromBackupResponse_tableDescription :: (Maybe TableDescription -> f (Maybe TableDescription))
-> RestoreTableFromBackupResponse
-> f RestoreTableFromBackupResponse
restoreTableFromBackupResponse_tableDescription = (RestoreTableFromBackupResponse -> Maybe TableDescription)
-> (RestoreTableFromBackupResponse
    -> Maybe TableDescription -> RestoreTableFromBackupResponse)
-> Lens
     RestoreTableFromBackupResponse
     RestoreTableFromBackupResponse
     (Maybe TableDescription)
     (Maybe TableDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromBackupResponse' {Maybe TableDescription
tableDescription :: Maybe TableDescription
$sel:tableDescription:RestoreTableFromBackupResponse' :: RestoreTableFromBackupResponse -> Maybe TableDescription
tableDescription} -> Maybe TableDescription
tableDescription) (\s :: RestoreTableFromBackupResponse
s@RestoreTableFromBackupResponse' {} Maybe TableDescription
a -> RestoreTableFromBackupResponse
s {$sel:tableDescription:RestoreTableFromBackupResponse' :: Maybe TableDescription
tableDescription = Maybe TableDescription
a} :: RestoreTableFromBackupResponse)

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

instance
  Prelude.NFData
    RestoreTableFromBackupResponse