{-# 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.Redshift.RestoreTableFromClusterSnapshot
-- 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 a table in an Amazon Redshift cluster snapshot.
-- You must create the new table within the Amazon Redshift cluster that
-- the snapshot was taken from.
--
-- You cannot use @RestoreTableFromClusterSnapshot@ to restore a table with
-- the same name as an existing table in an Amazon Redshift cluster. That
-- is, you cannot overwrite an existing table in a cluster with a restored
-- table. If you want to replace your original table with a new, restored
-- table, then rename or drop your original table before you call
-- @RestoreTableFromClusterSnapshot@. When you have renamed your original
-- table, then you can pass the original name of the table as the
-- @NewTableName@ parameter value in the call to
-- @RestoreTableFromClusterSnapshot@. This way, you can replace the
-- original table with the table created from the snapshot.
module Amazonka.Redshift.RestoreTableFromClusterSnapshot
  ( -- * Creating a Request
    RestoreTableFromClusterSnapshot (..),
    newRestoreTableFromClusterSnapshot,

    -- * Request Lenses
    restoreTableFromClusterSnapshot_targetSchemaName,
    restoreTableFromClusterSnapshot_enableCaseSensitiveIdentifier,
    restoreTableFromClusterSnapshot_targetDatabaseName,
    restoreTableFromClusterSnapshot_sourceSchemaName,
    restoreTableFromClusterSnapshot_clusterIdentifier,
    restoreTableFromClusterSnapshot_snapshotIdentifier,
    restoreTableFromClusterSnapshot_sourceDatabaseName,
    restoreTableFromClusterSnapshot_sourceTableName,
    restoreTableFromClusterSnapshot_newTableName,

    -- * Destructuring the Response
    RestoreTableFromClusterSnapshotResponse (..),
    newRestoreTableFromClusterSnapshotResponse,

    -- * Response Lenses
    restoreTableFromClusterSnapshotResponse_tableRestoreStatus,
    restoreTableFromClusterSnapshotResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newRestoreTableFromClusterSnapshot' smart constructor.
data RestoreTableFromClusterSnapshot = RestoreTableFromClusterSnapshot'
  { -- | The name of the schema to restore the table to.
    RestoreTableFromClusterSnapshot -> Maybe Text
targetSchemaName :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether name identifiers for database, schema, and table are
    -- case sensitive. If @true@, the names are case sensitive. If @false@
    -- (default), the names are not case sensitive.
    RestoreTableFromClusterSnapshot -> Maybe Bool
enableCaseSensitiveIdentifier :: Prelude.Maybe Prelude.Bool,
    -- | The name of the database to restore the table to.
    RestoreTableFromClusterSnapshot -> Maybe Text
targetDatabaseName :: Prelude.Maybe Prelude.Text,
    -- | The name of the source schema that contains the table to restore from.
    -- If you do not specify a @SourceSchemaName@ value, the default is
    -- @public@.
    RestoreTableFromClusterSnapshot -> Maybe Text
sourceSchemaName :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the Amazon Redshift cluster to restore the table to.
    RestoreTableFromClusterSnapshot -> Text
clusterIdentifier :: Prelude.Text,
    -- | The identifier of the snapshot to restore the table from. This snapshot
    -- must have been created from the Amazon Redshift cluster specified by the
    -- @ClusterIdentifier@ parameter.
    RestoreTableFromClusterSnapshot -> Text
snapshotIdentifier :: Prelude.Text,
    -- | The name of the source database that contains the table to restore from.
    RestoreTableFromClusterSnapshot -> Text
sourceDatabaseName :: Prelude.Text,
    -- | The name of the source table to restore from.
    RestoreTableFromClusterSnapshot -> Text
sourceTableName :: Prelude.Text,
    -- | The name of the table to create as a result of the current request.
    RestoreTableFromClusterSnapshot -> Text
newTableName' :: Prelude.Text
  }
  deriving (RestoreTableFromClusterSnapshot
-> RestoreTableFromClusterSnapshot -> Bool
(RestoreTableFromClusterSnapshot
 -> RestoreTableFromClusterSnapshot -> Bool)
-> (RestoreTableFromClusterSnapshot
    -> RestoreTableFromClusterSnapshot -> Bool)
-> Eq RestoreTableFromClusterSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreTableFromClusterSnapshot
-> RestoreTableFromClusterSnapshot -> Bool
$c/= :: RestoreTableFromClusterSnapshot
-> RestoreTableFromClusterSnapshot -> Bool
== :: RestoreTableFromClusterSnapshot
-> RestoreTableFromClusterSnapshot -> Bool
$c== :: RestoreTableFromClusterSnapshot
-> RestoreTableFromClusterSnapshot -> Bool
Prelude.Eq, ReadPrec [RestoreTableFromClusterSnapshot]
ReadPrec RestoreTableFromClusterSnapshot
Int -> ReadS RestoreTableFromClusterSnapshot
ReadS [RestoreTableFromClusterSnapshot]
(Int -> ReadS RestoreTableFromClusterSnapshot)
-> ReadS [RestoreTableFromClusterSnapshot]
-> ReadPrec RestoreTableFromClusterSnapshot
-> ReadPrec [RestoreTableFromClusterSnapshot]
-> Read RestoreTableFromClusterSnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreTableFromClusterSnapshot]
$creadListPrec :: ReadPrec [RestoreTableFromClusterSnapshot]
readPrec :: ReadPrec RestoreTableFromClusterSnapshot
$creadPrec :: ReadPrec RestoreTableFromClusterSnapshot
readList :: ReadS [RestoreTableFromClusterSnapshot]
$creadList :: ReadS [RestoreTableFromClusterSnapshot]
readsPrec :: Int -> ReadS RestoreTableFromClusterSnapshot
$creadsPrec :: Int -> ReadS RestoreTableFromClusterSnapshot
Prelude.Read, Int -> RestoreTableFromClusterSnapshot -> ShowS
[RestoreTableFromClusterSnapshot] -> ShowS
RestoreTableFromClusterSnapshot -> String
(Int -> RestoreTableFromClusterSnapshot -> ShowS)
-> (RestoreTableFromClusterSnapshot -> String)
-> ([RestoreTableFromClusterSnapshot] -> ShowS)
-> Show RestoreTableFromClusterSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreTableFromClusterSnapshot] -> ShowS
$cshowList :: [RestoreTableFromClusterSnapshot] -> ShowS
show :: RestoreTableFromClusterSnapshot -> String
$cshow :: RestoreTableFromClusterSnapshot -> String
showsPrec :: Int -> RestoreTableFromClusterSnapshot -> ShowS
$cshowsPrec :: Int -> RestoreTableFromClusterSnapshot -> ShowS
Prelude.Show, (forall x.
 RestoreTableFromClusterSnapshot
 -> Rep RestoreTableFromClusterSnapshot x)
-> (forall x.
    Rep RestoreTableFromClusterSnapshot x
    -> RestoreTableFromClusterSnapshot)
-> Generic RestoreTableFromClusterSnapshot
forall x.
Rep RestoreTableFromClusterSnapshot x
-> RestoreTableFromClusterSnapshot
forall x.
RestoreTableFromClusterSnapshot
-> Rep RestoreTableFromClusterSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RestoreTableFromClusterSnapshot x
-> RestoreTableFromClusterSnapshot
$cfrom :: forall x.
RestoreTableFromClusterSnapshot
-> Rep RestoreTableFromClusterSnapshot x
Prelude.Generic)

-- |
-- Create a value of 'RestoreTableFromClusterSnapshot' 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:
--
-- 'targetSchemaName', 'restoreTableFromClusterSnapshot_targetSchemaName' - The name of the schema to restore the table to.
--
-- 'enableCaseSensitiveIdentifier', 'restoreTableFromClusterSnapshot_enableCaseSensitiveIdentifier' - Indicates whether name identifiers for database, schema, and table are
-- case sensitive. If @true@, the names are case sensitive. If @false@
-- (default), the names are not case sensitive.
--
-- 'targetDatabaseName', 'restoreTableFromClusterSnapshot_targetDatabaseName' - The name of the database to restore the table to.
--
-- 'sourceSchemaName', 'restoreTableFromClusterSnapshot_sourceSchemaName' - The name of the source schema that contains the table to restore from.
-- If you do not specify a @SourceSchemaName@ value, the default is
-- @public@.
--
-- 'clusterIdentifier', 'restoreTableFromClusterSnapshot_clusterIdentifier' - The identifier of the Amazon Redshift cluster to restore the table to.
--
-- 'snapshotIdentifier', 'restoreTableFromClusterSnapshot_snapshotIdentifier' - The identifier of the snapshot to restore the table from. This snapshot
-- must have been created from the Amazon Redshift cluster specified by the
-- @ClusterIdentifier@ parameter.
--
-- 'sourceDatabaseName', 'restoreTableFromClusterSnapshot_sourceDatabaseName' - The name of the source database that contains the table to restore from.
--
-- 'sourceTableName', 'restoreTableFromClusterSnapshot_sourceTableName' - The name of the source table to restore from.
--
-- 'newTableName'', 'restoreTableFromClusterSnapshot_newTableName' - The name of the table to create as a result of the current request.
newRestoreTableFromClusterSnapshot ::
  -- | 'clusterIdentifier'
  Prelude.Text ->
  -- | 'snapshotIdentifier'
  Prelude.Text ->
  -- | 'sourceDatabaseName'
  Prelude.Text ->
  -- | 'sourceTableName'
  Prelude.Text ->
  -- | 'newTableName''
  Prelude.Text ->
  RestoreTableFromClusterSnapshot
newRestoreTableFromClusterSnapshot :: Text
-> Text -> Text -> Text -> Text -> RestoreTableFromClusterSnapshot
newRestoreTableFromClusterSnapshot
  Text
pClusterIdentifier_
  Text
pSnapshotIdentifier_
  Text
pSourceDatabaseName_
  Text
pSourceTableName_
  Text
pNewTableName_ =
    RestoreTableFromClusterSnapshot' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> RestoreTableFromClusterSnapshot
RestoreTableFromClusterSnapshot'
      { $sel:targetSchemaName:RestoreTableFromClusterSnapshot' :: Maybe Text
targetSchemaName =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:enableCaseSensitiveIdentifier:RestoreTableFromClusterSnapshot' :: Maybe Bool
enableCaseSensitiveIdentifier =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:targetDatabaseName:RestoreTableFromClusterSnapshot' :: Maybe Text
targetDatabaseName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceSchemaName:RestoreTableFromClusterSnapshot' :: Maybe Text
sourceSchemaName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:clusterIdentifier:RestoreTableFromClusterSnapshot' :: Text
clusterIdentifier = Text
pClusterIdentifier_,
        $sel:snapshotIdentifier:RestoreTableFromClusterSnapshot' :: Text
snapshotIdentifier = Text
pSnapshotIdentifier_,
        $sel:sourceDatabaseName:RestoreTableFromClusterSnapshot' :: Text
sourceDatabaseName = Text
pSourceDatabaseName_,
        $sel:sourceTableName:RestoreTableFromClusterSnapshot' :: Text
sourceTableName = Text
pSourceTableName_,
        $sel:newTableName':RestoreTableFromClusterSnapshot' :: Text
newTableName' = Text
pNewTableName_
      }

-- | The name of the schema to restore the table to.
restoreTableFromClusterSnapshot_targetSchemaName :: Lens.Lens' RestoreTableFromClusterSnapshot (Prelude.Maybe Prelude.Text)
restoreTableFromClusterSnapshot_targetSchemaName :: (Maybe Text -> f (Maybe Text))
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_targetSchemaName = (RestoreTableFromClusterSnapshot -> Maybe Text)
-> (RestoreTableFromClusterSnapshot
    -> Maybe Text -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Maybe Text
targetSchemaName :: Maybe Text
$sel:targetSchemaName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Maybe Text
targetSchemaName} -> Maybe Text
targetSchemaName) (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Maybe Text
a -> RestoreTableFromClusterSnapshot
s {$sel:targetSchemaName:RestoreTableFromClusterSnapshot' :: Maybe Text
targetSchemaName = Maybe Text
a} :: RestoreTableFromClusterSnapshot)

-- | Indicates whether name identifiers for database, schema, and table are
-- case sensitive. If @true@, the names are case sensitive. If @false@
-- (default), the names are not case sensitive.
restoreTableFromClusterSnapshot_enableCaseSensitiveIdentifier :: Lens.Lens' RestoreTableFromClusterSnapshot (Prelude.Maybe Prelude.Bool)
restoreTableFromClusterSnapshot_enableCaseSensitiveIdentifier :: (Maybe Bool -> f (Maybe Bool))
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_enableCaseSensitiveIdentifier = (RestoreTableFromClusterSnapshot -> Maybe Bool)
-> (RestoreTableFromClusterSnapshot
    -> Maybe Bool -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Maybe Bool
enableCaseSensitiveIdentifier :: Maybe Bool
$sel:enableCaseSensitiveIdentifier:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Maybe Bool
enableCaseSensitiveIdentifier} -> Maybe Bool
enableCaseSensitiveIdentifier) (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Maybe Bool
a -> RestoreTableFromClusterSnapshot
s {$sel:enableCaseSensitiveIdentifier:RestoreTableFromClusterSnapshot' :: Maybe Bool
enableCaseSensitiveIdentifier = Maybe Bool
a} :: RestoreTableFromClusterSnapshot)

-- | The name of the database to restore the table to.
restoreTableFromClusterSnapshot_targetDatabaseName :: Lens.Lens' RestoreTableFromClusterSnapshot (Prelude.Maybe Prelude.Text)
restoreTableFromClusterSnapshot_targetDatabaseName :: (Maybe Text -> f (Maybe Text))
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_targetDatabaseName = (RestoreTableFromClusterSnapshot -> Maybe Text)
-> (RestoreTableFromClusterSnapshot
    -> Maybe Text -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Maybe Text
targetDatabaseName :: Maybe Text
$sel:targetDatabaseName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Maybe Text
targetDatabaseName} -> Maybe Text
targetDatabaseName) (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Maybe Text
a -> RestoreTableFromClusterSnapshot
s {$sel:targetDatabaseName:RestoreTableFromClusterSnapshot' :: Maybe Text
targetDatabaseName = Maybe Text
a} :: RestoreTableFromClusterSnapshot)

-- | The name of the source schema that contains the table to restore from.
-- If you do not specify a @SourceSchemaName@ value, the default is
-- @public@.
restoreTableFromClusterSnapshot_sourceSchemaName :: Lens.Lens' RestoreTableFromClusterSnapshot (Prelude.Maybe Prelude.Text)
restoreTableFromClusterSnapshot_sourceSchemaName :: (Maybe Text -> f (Maybe Text))
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_sourceSchemaName = (RestoreTableFromClusterSnapshot -> Maybe Text)
-> (RestoreTableFromClusterSnapshot
    -> Maybe Text -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Maybe Text
sourceSchemaName :: Maybe Text
$sel:sourceSchemaName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Maybe Text
sourceSchemaName} -> Maybe Text
sourceSchemaName) (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Maybe Text
a -> RestoreTableFromClusterSnapshot
s {$sel:sourceSchemaName:RestoreTableFromClusterSnapshot' :: Maybe Text
sourceSchemaName = Maybe Text
a} :: RestoreTableFromClusterSnapshot)

-- | The identifier of the Amazon Redshift cluster to restore the table to.
restoreTableFromClusterSnapshot_clusterIdentifier :: Lens.Lens' RestoreTableFromClusterSnapshot Prelude.Text
restoreTableFromClusterSnapshot_clusterIdentifier :: (Text -> f Text)
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_clusterIdentifier = (RestoreTableFromClusterSnapshot -> Text)
-> (RestoreTableFromClusterSnapshot
    -> Text -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Text
a -> RestoreTableFromClusterSnapshot
s {$sel:clusterIdentifier:RestoreTableFromClusterSnapshot' :: Text
clusterIdentifier = Text
a} :: RestoreTableFromClusterSnapshot)

-- | The identifier of the snapshot to restore the table from. This snapshot
-- must have been created from the Amazon Redshift cluster specified by the
-- @ClusterIdentifier@ parameter.
restoreTableFromClusterSnapshot_snapshotIdentifier :: Lens.Lens' RestoreTableFromClusterSnapshot Prelude.Text
restoreTableFromClusterSnapshot_snapshotIdentifier :: (Text -> f Text)
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_snapshotIdentifier = (RestoreTableFromClusterSnapshot -> Text)
-> (RestoreTableFromClusterSnapshot
    -> Text -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Text
snapshotIdentifier :: Text
$sel:snapshotIdentifier:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
snapshotIdentifier} -> Text
snapshotIdentifier) (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Text
a -> RestoreTableFromClusterSnapshot
s {$sel:snapshotIdentifier:RestoreTableFromClusterSnapshot' :: Text
snapshotIdentifier = Text
a} :: RestoreTableFromClusterSnapshot)

-- | The name of the source database that contains the table to restore from.
restoreTableFromClusterSnapshot_sourceDatabaseName :: Lens.Lens' RestoreTableFromClusterSnapshot Prelude.Text
restoreTableFromClusterSnapshot_sourceDatabaseName :: (Text -> f Text)
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_sourceDatabaseName = (RestoreTableFromClusterSnapshot -> Text)
-> (RestoreTableFromClusterSnapshot
    -> Text -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Text
sourceDatabaseName :: Text
$sel:sourceDatabaseName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
sourceDatabaseName} -> Text
sourceDatabaseName) (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Text
a -> RestoreTableFromClusterSnapshot
s {$sel:sourceDatabaseName:RestoreTableFromClusterSnapshot' :: Text
sourceDatabaseName = Text
a} :: RestoreTableFromClusterSnapshot)

-- | The name of the source table to restore from.
restoreTableFromClusterSnapshot_sourceTableName :: Lens.Lens' RestoreTableFromClusterSnapshot Prelude.Text
restoreTableFromClusterSnapshot_sourceTableName :: (Text -> f Text)
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_sourceTableName = (RestoreTableFromClusterSnapshot -> Text)
-> (RestoreTableFromClusterSnapshot
    -> Text -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Text
sourceTableName :: Text
$sel:sourceTableName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
sourceTableName} -> Text
sourceTableName) (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Text
a -> RestoreTableFromClusterSnapshot
s {$sel:sourceTableName:RestoreTableFromClusterSnapshot' :: Text
sourceTableName = Text
a} :: RestoreTableFromClusterSnapshot)

-- | The name of the table to create as a result of the current request.
restoreTableFromClusterSnapshot_newTableName :: Lens.Lens' RestoreTableFromClusterSnapshot Prelude.Text
restoreTableFromClusterSnapshot_newTableName :: (Text -> f Text)
-> RestoreTableFromClusterSnapshot
-> f RestoreTableFromClusterSnapshot
restoreTableFromClusterSnapshot_newTableName = (RestoreTableFromClusterSnapshot -> Text)
-> (RestoreTableFromClusterSnapshot
    -> Text -> RestoreTableFromClusterSnapshot)
-> Lens
     RestoreTableFromClusterSnapshot
     RestoreTableFromClusterSnapshot
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshot' {Text
newTableName' :: Text
$sel:newTableName':RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
newTableName'} -> Text
newTableName') (\s :: RestoreTableFromClusterSnapshot
s@RestoreTableFromClusterSnapshot' {} Text
a -> RestoreTableFromClusterSnapshot
s {$sel:newTableName':RestoreTableFromClusterSnapshot' :: Text
newTableName' = Text
a} :: RestoreTableFromClusterSnapshot)

instance
  Core.AWSRequest
    RestoreTableFromClusterSnapshot
  where
  type
    AWSResponse RestoreTableFromClusterSnapshot =
      RestoreTableFromClusterSnapshotResponse
  request :: RestoreTableFromClusterSnapshot
-> Request RestoreTableFromClusterSnapshot
request = Service
-> RestoreTableFromClusterSnapshot
-> Request RestoreTableFromClusterSnapshot
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy RestoreTableFromClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse RestoreTableFromClusterSnapshot)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse RestoreTableFromClusterSnapshot))
-> Logger
-> Service
-> Proxy RestoreTableFromClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse RestoreTableFromClusterSnapshot)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"RestoreTableFromClusterSnapshotResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe TableRestoreStatus
-> Int -> RestoreTableFromClusterSnapshotResponse
RestoreTableFromClusterSnapshotResponse'
            (Maybe TableRestoreStatus
 -> Int -> RestoreTableFromClusterSnapshotResponse)
-> Either String (Maybe TableRestoreStatus)
-> Either String (Int -> RestoreTableFromClusterSnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe TableRestoreStatus)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TableRestoreStatus")
            Either String (Int -> RestoreTableFromClusterSnapshotResponse)
-> Either String Int
-> Either String RestoreTableFromClusterSnapshotResponse
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
    RestoreTableFromClusterSnapshot

instance
  Prelude.NFData
    RestoreTableFromClusterSnapshot

instance
  Core.ToHeaders
    RestoreTableFromClusterSnapshot
  where
  toHeaders :: RestoreTableFromClusterSnapshot -> ResponseHeaders
toHeaders = ResponseHeaders
-> RestoreTableFromClusterSnapshot -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery RestoreTableFromClusterSnapshot where
  toQuery :: RestoreTableFromClusterSnapshot -> QueryString
toQuery RestoreTableFromClusterSnapshot' {Maybe Bool
Maybe Text
Text
newTableName' :: Text
sourceTableName :: Text
sourceDatabaseName :: Text
snapshotIdentifier :: Text
clusterIdentifier :: Text
sourceSchemaName :: Maybe Text
targetDatabaseName :: Maybe Text
enableCaseSensitiveIdentifier :: Maybe Bool
targetSchemaName :: Maybe Text
$sel:newTableName':RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
$sel:sourceTableName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
$sel:sourceDatabaseName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
$sel:snapshotIdentifier:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
$sel:clusterIdentifier:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Text
$sel:sourceSchemaName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Maybe Text
$sel:targetDatabaseName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Maybe Text
$sel:enableCaseSensitiveIdentifier:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Maybe Bool
$sel:targetSchemaName:RestoreTableFromClusterSnapshot' :: RestoreTableFromClusterSnapshot -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"RestoreTableFromClusterSnapshot" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"TargetSchemaName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
targetSchemaName,
        ByteString
"EnableCaseSensitiveIdentifier"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
enableCaseSensitiveIdentifier,
        ByteString
"TargetDatabaseName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
targetDatabaseName,
        ByteString
"SourceSchemaName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sourceSchemaName,
        ByteString
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier,
        ByteString
"SnapshotIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
snapshotIdentifier,
        ByteString
"SourceDatabaseName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sourceDatabaseName,
        ByteString
"SourceTableName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sourceTableName,
        ByteString
"NewTableName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
newTableName'
      ]

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

-- |
-- Create a value of 'RestoreTableFromClusterSnapshotResponse' 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:
--
-- 'tableRestoreStatus', 'restoreTableFromClusterSnapshotResponse_tableRestoreStatus' - Undocumented member.
--
-- 'httpStatus', 'restoreTableFromClusterSnapshotResponse_httpStatus' - The response's http status code.
newRestoreTableFromClusterSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RestoreTableFromClusterSnapshotResponse
newRestoreTableFromClusterSnapshotResponse :: Int -> RestoreTableFromClusterSnapshotResponse
newRestoreTableFromClusterSnapshotResponse
  Int
pHttpStatus_ =
    RestoreTableFromClusterSnapshotResponse' :: Maybe TableRestoreStatus
-> Int -> RestoreTableFromClusterSnapshotResponse
RestoreTableFromClusterSnapshotResponse'
      { $sel:tableRestoreStatus:RestoreTableFromClusterSnapshotResponse' :: Maybe TableRestoreStatus
tableRestoreStatus =
          Maybe TableRestoreStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:RestoreTableFromClusterSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Undocumented member.
restoreTableFromClusterSnapshotResponse_tableRestoreStatus :: Lens.Lens' RestoreTableFromClusterSnapshotResponse (Prelude.Maybe TableRestoreStatus)
restoreTableFromClusterSnapshotResponse_tableRestoreStatus :: (Maybe TableRestoreStatus -> f (Maybe TableRestoreStatus))
-> RestoreTableFromClusterSnapshotResponse
-> f RestoreTableFromClusterSnapshotResponse
restoreTableFromClusterSnapshotResponse_tableRestoreStatus = (RestoreTableFromClusterSnapshotResponse
 -> Maybe TableRestoreStatus)
-> (RestoreTableFromClusterSnapshotResponse
    -> Maybe TableRestoreStatus
    -> RestoreTableFromClusterSnapshotResponse)
-> Lens
     RestoreTableFromClusterSnapshotResponse
     RestoreTableFromClusterSnapshotResponse
     (Maybe TableRestoreStatus)
     (Maybe TableRestoreStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreTableFromClusterSnapshotResponse' {Maybe TableRestoreStatus
tableRestoreStatus :: Maybe TableRestoreStatus
$sel:tableRestoreStatus:RestoreTableFromClusterSnapshotResponse' :: RestoreTableFromClusterSnapshotResponse -> Maybe TableRestoreStatus
tableRestoreStatus} -> Maybe TableRestoreStatus
tableRestoreStatus) (\s :: RestoreTableFromClusterSnapshotResponse
s@RestoreTableFromClusterSnapshotResponse' {} Maybe TableRestoreStatus
a -> RestoreTableFromClusterSnapshotResponse
s {$sel:tableRestoreStatus:RestoreTableFromClusterSnapshotResponse' :: Maybe TableRestoreStatus
tableRestoreStatus = Maybe TableRestoreStatus
a} :: RestoreTableFromClusterSnapshotResponse)

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

instance
  Prelude.NFData
    RestoreTableFromClusterSnapshotResponse