{-# 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.ExportTableToPointInTime
-- 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)
--
-- Exports table data to an S3 bucket. The table must have point in time
-- recovery enabled, and you can export data from any time within the point
-- in time recovery window.
module Amazonka.DynamoDB.ExportTableToPointInTime
  ( -- * Creating a Request
    ExportTableToPointInTime (..),
    newExportTableToPointInTime,

    -- * Request Lenses
    exportTableToPointInTime_s3BucketOwner,
    exportTableToPointInTime_exportFormat,
    exportTableToPointInTime_s3SseKmsKeyId,
    exportTableToPointInTime_clientToken,
    exportTableToPointInTime_exportTime,
    exportTableToPointInTime_s3SseAlgorithm,
    exportTableToPointInTime_s3Prefix,
    exportTableToPointInTime_tableArn,
    exportTableToPointInTime_s3Bucket,

    -- * Destructuring the Response
    ExportTableToPointInTimeResponse (..),
    newExportTableToPointInTimeResponse,

    -- * Response Lenses
    exportTableToPointInTimeResponse_exportDescription,
    exportTableToPointInTimeResponse_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:/ 'newExportTableToPointInTime' smart constructor.
data ExportTableToPointInTime = ExportTableToPointInTime'
  { -- | The ID of the AWS account that owns the bucket the export will be stored
    -- in.
    ExportTableToPointInTime -> Maybe Text
s3BucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The format for the exported data. Valid values for @ExportFormat@ are
    -- @DYNAMODB_JSON@ or @ION@.
    ExportTableToPointInTime -> Maybe ExportFormat
exportFormat :: Prelude.Maybe ExportFormat,
    -- | The ID of the AWS KMS managed key used to encrypt the S3 bucket where
    -- export data will be stored (if applicable).
    ExportTableToPointInTime -> Maybe Text
s3SseKmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Providing a @ClientToken@ makes the call to
    -- @ExportTableToPointInTimeInput@ idempotent, meaning that multiple
    -- identical calls have the same effect as one single call.
    --
    -- A client token is valid for 8 hours after the first request that uses it
    -- is completed. After 8 hours, any request with the same client token is
    -- treated as a new request. Do not resubmit the same request with the same
    -- client token for more than 8 hours, or the result might not be
    -- idempotent.
    --
    -- If you submit a request with the same client token but a change in other
    -- parameters within the 8-hour idempotency window, DynamoDB returns an
    -- @IdempotentParameterMismatch@ exception.
    ExportTableToPointInTime -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Time in the past from which to export table data. The table export will
    -- be a snapshot of the table\'s state at this point in time.
    ExportTableToPointInTime -> Maybe POSIX
exportTime :: Prelude.Maybe Core.POSIX,
    -- | Type of encryption used on the bucket where export data will be stored.
    -- Valid values for @S3SseAlgorithm@ are:
    --
    -- -   @AES256@ - server-side encryption with Amazon S3 managed keys
    --
    -- -   @KMS@ - server-side encryption with AWS KMS managed keys
    ExportTableToPointInTime -> Maybe S3SseAlgorithm
s3SseAlgorithm :: Prelude.Maybe S3SseAlgorithm,
    -- | The Amazon S3 bucket prefix to use as the file name and path of the
    -- exported snapshot.
    ExportTableToPointInTime -> Maybe Text
s3Prefix :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) associated with the table to export.
    ExportTableToPointInTime -> Text
tableArn :: Prelude.Text,
    -- | The name of the Amazon S3 bucket to export the snapshot to.
    ExportTableToPointInTime -> Text
s3Bucket :: Prelude.Text
  }
  deriving (ExportTableToPointInTime -> ExportTableToPointInTime -> Bool
(ExportTableToPointInTime -> ExportTableToPointInTime -> Bool)
-> (ExportTableToPointInTime -> ExportTableToPointInTime -> Bool)
-> Eq ExportTableToPointInTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportTableToPointInTime -> ExportTableToPointInTime -> Bool
$c/= :: ExportTableToPointInTime -> ExportTableToPointInTime -> Bool
== :: ExportTableToPointInTime -> ExportTableToPointInTime -> Bool
$c== :: ExportTableToPointInTime -> ExportTableToPointInTime -> Bool
Prelude.Eq, ReadPrec [ExportTableToPointInTime]
ReadPrec ExportTableToPointInTime
Int -> ReadS ExportTableToPointInTime
ReadS [ExportTableToPointInTime]
(Int -> ReadS ExportTableToPointInTime)
-> ReadS [ExportTableToPointInTime]
-> ReadPrec ExportTableToPointInTime
-> ReadPrec [ExportTableToPointInTime]
-> Read ExportTableToPointInTime
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportTableToPointInTime]
$creadListPrec :: ReadPrec [ExportTableToPointInTime]
readPrec :: ReadPrec ExportTableToPointInTime
$creadPrec :: ReadPrec ExportTableToPointInTime
readList :: ReadS [ExportTableToPointInTime]
$creadList :: ReadS [ExportTableToPointInTime]
readsPrec :: Int -> ReadS ExportTableToPointInTime
$creadsPrec :: Int -> ReadS ExportTableToPointInTime
Prelude.Read, Int -> ExportTableToPointInTime -> ShowS
[ExportTableToPointInTime] -> ShowS
ExportTableToPointInTime -> String
(Int -> ExportTableToPointInTime -> ShowS)
-> (ExportTableToPointInTime -> String)
-> ([ExportTableToPointInTime] -> ShowS)
-> Show ExportTableToPointInTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportTableToPointInTime] -> ShowS
$cshowList :: [ExportTableToPointInTime] -> ShowS
show :: ExportTableToPointInTime -> String
$cshow :: ExportTableToPointInTime -> String
showsPrec :: Int -> ExportTableToPointInTime -> ShowS
$cshowsPrec :: Int -> ExportTableToPointInTime -> ShowS
Prelude.Show, (forall x.
 ExportTableToPointInTime -> Rep ExportTableToPointInTime x)
-> (forall x.
    Rep ExportTableToPointInTime x -> ExportTableToPointInTime)
-> Generic ExportTableToPointInTime
forall x.
Rep ExportTableToPointInTime x -> ExportTableToPointInTime
forall x.
ExportTableToPointInTime -> Rep ExportTableToPointInTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExportTableToPointInTime x -> ExportTableToPointInTime
$cfrom :: forall x.
ExportTableToPointInTime -> Rep ExportTableToPointInTime x
Prelude.Generic)

-- |
-- Create a value of 'ExportTableToPointInTime' 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:
--
-- 's3BucketOwner', 'exportTableToPointInTime_s3BucketOwner' - The ID of the AWS account that owns the bucket the export will be stored
-- in.
--
-- 'exportFormat', 'exportTableToPointInTime_exportFormat' - The format for the exported data. Valid values for @ExportFormat@ are
-- @DYNAMODB_JSON@ or @ION@.
--
-- 's3SseKmsKeyId', 'exportTableToPointInTime_s3SseKmsKeyId' - The ID of the AWS KMS managed key used to encrypt the S3 bucket where
-- export data will be stored (if applicable).
--
-- 'clientToken', 'exportTableToPointInTime_clientToken' - Providing a @ClientToken@ makes the call to
-- @ExportTableToPointInTimeInput@ idempotent, meaning that multiple
-- identical calls have the same effect as one single call.
--
-- A client token is valid for 8 hours after the first request that uses it
-- is completed. After 8 hours, any request with the same client token is
-- treated as a new request. Do not resubmit the same request with the same
-- client token for more than 8 hours, or the result might not be
-- idempotent.
--
-- If you submit a request with the same client token but a change in other
-- parameters within the 8-hour idempotency window, DynamoDB returns an
-- @IdempotentParameterMismatch@ exception.
--
-- 'exportTime', 'exportTableToPointInTime_exportTime' - Time in the past from which to export table data. The table export will
-- be a snapshot of the table\'s state at this point in time.
--
-- 's3SseAlgorithm', 'exportTableToPointInTime_s3SseAlgorithm' - Type of encryption used on the bucket where export data will be stored.
-- Valid values for @S3SseAlgorithm@ are:
--
-- -   @AES256@ - server-side encryption with Amazon S3 managed keys
--
-- -   @KMS@ - server-side encryption with AWS KMS managed keys
--
-- 's3Prefix', 'exportTableToPointInTime_s3Prefix' - The Amazon S3 bucket prefix to use as the file name and path of the
-- exported snapshot.
--
-- 'tableArn', 'exportTableToPointInTime_tableArn' - The Amazon Resource Name (ARN) associated with the table to export.
--
-- 's3Bucket', 'exportTableToPointInTime_s3Bucket' - The name of the Amazon S3 bucket to export the snapshot to.
newExportTableToPointInTime ::
  -- | 'tableArn'
  Prelude.Text ->
  -- | 's3Bucket'
  Prelude.Text ->
  ExportTableToPointInTime
newExportTableToPointInTime :: Text -> Text -> ExportTableToPointInTime
newExportTableToPointInTime Text
pTableArn_ Text
pS3Bucket_ =
  ExportTableToPointInTime' :: Maybe Text
-> Maybe ExportFormat
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe S3SseAlgorithm
-> Maybe Text
-> Text
-> Text
-> ExportTableToPointInTime
ExportTableToPointInTime'
    { $sel:s3BucketOwner:ExportTableToPointInTime' :: Maybe Text
s3BucketOwner =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:exportFormat:ExportTableToPointInTime' :: Maybe ExportFormat
exportFormat = Maybe ExportFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:s3SseKmsKeyId:ExportTableToPointInTime' :: Maybe Text
s3SseKmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientToken:ExportTableToPointInTime' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:exportTime:ExportTableToPointInTime' :: Maybe POSIX
exportTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:s3SseAlgorithm:ExportTableToPointInTime' :: Maybe S3SseAlgorithm
s3SseAlgorithm = Maybe S3SseAlgorithm
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Prefix:ExportTableToPointInTime' :: Maybe Text
s3Prefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tableArn:ExportTableToPointInTime' :: Text
tableArn = Text
pTableArn_,
      $sel:s3Bucket:ExportTableToPointInTime' :: Text
s3Bucket = Text
pS3Bucket_
    }

-- | The ID of the AWS account that owns the bucket the export will be stored
-- in.
exportTableToPointInTime_s3BucketOwner :: Lens.Lens' ExportTableToPointInTime (Prelude.Maybe Prelude.Text)
exportTableToPointInTime_s3BucketOwner :: (Maybe Text -> f (Maybe Text))
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_s3BucketOwner = (ExportTableToPointInTime -> Maybe Text)
-> (ExportTableToPointInTime
    -> Maybe Text -> ExportTableToPointInTime)
-> Lens
     ExportTableToPointInTime
     ExportTableToPointInTime
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Maybe Text
s3BucketOwner :: Maybe Text
$sel:s3BucketOwner:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe Text
s3BucketOwner} -> Maybe Text
s3BucketOwner) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Maybe Text
a -> ExportTableToPointInTime
s {$sel:s3BucketOwner:ExportTableToPointInTime' :: Maybe Text
s3BucketOwner = Maybe Text
a} :: ExportTableToPointInTime)

-- | The format for the exported data. Valid values for @ExportFormat@ are
-- @DYNAMODB_JSON@ or @ION@.
exportTableToPointInTime_exportFormat :: Lens.Lens' ExportTableToPointInTime (Prelude.Maybe ExportFormat)
exportTableToPointInTime_exportFormat :: (Maybe ExportFormat -> f (Maybe ExportFormat))
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_exportFormat = (ExportTableToPointInTime -> Maybe ExportFormat)
-> (ExportTableToPointInTime
    -> Maybe ExportFormat -> ExportTableToPointInTime)
-> Lens
     ExportTableToPointInTime
     ExportTableToPointInTime
     (Maybe ExportFormat)
     (Maybe ExportFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Maybe ExportFormat
exportFormat :: Maybe ExportFormat
$sel:exportFormat:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe ExportFormat
exportFormat} -> Maybe ExportFormat
exportFormat) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Maybe ExportFormat
a -> ExportTableToPointInTime
s {$sel:exportFormat:ExportTableToPointInTime' :: Maybe ExportFormat
exportFormat = Maybe ExportFormat
a} :: ExportTableToPointInTime)

-- | The ID of the AWS KMS managed key used to encrypt the S3 bucket where
-- export data will be stored (if applicable).
exportTableToPointInTime_s3SseKmsKeyId :: Lens.Lens' ExportTableToPointInTime (Prelude.Maybe Prelude.Text)
exportTableToPointInTime_s3SseKmsKeyId :: (Maybe Text -> f (Maybe Text))
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_s3SseKmsKeyId = (ExportTableToPointInTime -> Maybe Text)
-> (ExportTableToPointInTime
    -> Maybe Text -> ExportTableToPointInTime)
-> Lens
     ExportTableToPointInTime
     ExportTableToPointInTime
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Maybe Text
s3SseKmsKeyId :: Maybe Text
$sel:s3SseKmsKeyId:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe Text
s3SseKmsKeyId} -> Maybe Text
s3SseKmsKeyId) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Maybe Text
a -> ExportTableToPointInTime
s {$sel:s3SseKmsKeyId:ExportTableToPointInTime' :: Maybe Text
s3SseKmsKeyId = Maybe Text
a} :: ExportTableToPointInTime)

-- | Providing a @ClientToken@ makes the call to
-- @ExportTableToPointInTimeInput@ idempotent, meaning that multiple
-- identical calls have the same effect as one single call.
--
-- A client token is valid for 8 hours after the first request that uses it
-- is completed. After 8 hours, any request with the same client token is
-- treated as a new request. Do not resubmit the same request with the same
-- client token for more than 8 hours, or the result might not be
-- idempotent.
--
-- If you submit a request with the same client token but a change in other
-- parameters within the 8-hour idempotency window, DynamoDB returns an
-- @IdempotentParameterMismatch@ exception.
exportTableToPointInTime_clientToken :: Lens.Lens' ExportTableToPointInTime (Prelude.Maybe Prelude.Text)
exportTableToPointInTime_clientToken :: (Maybe Text -> f (Maybe Text))
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_clientToken = (ExportTableToPointInTime -> Maybe Text)
-> (ExportTableToPointInTime
    -> Maybe Text -> ExportTableToPointInTime)
-> Lens
     ExportTableToPointInTime
     ExportTableToPointInTime
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Maybe Text
a -> ExportTableToPointInTime
s {$sel:clientToken:ExportTableToPointInTime' :: Maybe Text
clientToken = Maybe Text
a} :: ExportTableToPointInTime)

-- | Time in the past from which to export table data. The table export will
-- be a snapshot of the table\'s state at this point in time.
exportTableToPointInTime_exportTime :: Lens.Lens' ExportTableToPointInTime (Prelude.Maybe Prelude.UTCTime)
exportTableToPointInTime_exportTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_exportTime = (ExportTableToPointInTime -> Maybe POSIX)
-> (ExportTableToPointInTime
    -> Maybe POSIX -> ExportTableToPointInTime)
-> Lens
     ExportTableToPointInTime
     ExportTableToPointInTime
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Maybe POSIX
exportTime :: Maybe POSIX
$sel:exportTime:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe POSIX
exportTime} -> Maybe POSIX
exportTime) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Maybe POSIX
a -> ExportTableToPointInTime
s {$sel:exportTime:ExportTableToPointInTime' :: Maybe POSIX
exportTime = Maybe POSIX
a} :: ExportTableToPointInTime) ((Maybe POSIX -> f (Maybe POSIX))
 -> ExportTableToPointInTime -> f ExportTableToPointInTime)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ExportTableToPointInTime
-> f ExportTableToPointInTime
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Type of encryption used on the bucket where export data will be stored.
-- Valid values for @S3SseAlgorithm@ are:
--
-- -   @AES256@ - server-side encryption with Amazon S3 managed keys
--
-- -   @KMS@ - server-side encryption with AWS KMS managed keys
exportTableToPointInTime_s3SseAlgorithm :: Lens.Lens' ExportTableToPointInTime (Prelude.Maybe S3SseAlgorithm)
exportTableToPointInTime_s3SseAlgorithm :: (Maybe S3SseAlgorithm -> f (Maybe S3SseAlgorithm))
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_s3SseAlgorithm = (ExportTableToPointInTime -> Maybe S3SseAlgorithm)
-> (ExportTableToPointInTime
    -> Maybe S3SseAlgorithm -> ExportTableToPointInTime)
-> Lens
     ExportTableToPointInTime
     ExportTableToPointInTime
     (Maybe S3SseAlgorithm)
     (Maybe S3SseAlgorithm)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Maybe S3SseAlgorithm
s3SseAlgorithm :: Maybe S3SseAlgorithm
$sel:s3SseAlgorithm:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe S3SseAlgorithm
s3SseAlgorithm} -> Maybe S3SseAlgorithm
s3SseAlgorithm) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Maybe S3SseAlgorithm
a -> ExportTableToPointInTime
s {$sel:s3SseAlgorithm:ExportTableToPointInTime' :: Maybe S3SseAlgorithm
s3SseAlgorithm = Maybe S3SseAlgorithm
a} :: ExportTableToPointInTime)

-- | The Amazon S3 bucket prefix to use as the file name and path of the
-- exported snapshot.
exportTableToPointInTime_s3Prefix :: Lens.Lens' ExportTableToPointInTime (Prelude.Maybe Prelude.Text)
exportTableToPointInTime_s3Prefix :: (Maybe Text -> f (Maybe Text))
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_s3Prefix = (ExportTableToPointInTime -> Maybe Text)
-> (ExportTableToPointInTime
    -> Maybe Text -> ExportTableToPointInTime)
-> Lens
     ExportTableToPointInTime
     ExportTableToPointInTime
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Maybe Text
s3Prefix :: Maybe Text
$sel:s3Prefix:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe Text
s3Prefix} -> Maybe Text
s3Prefix) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Maybe Text
a -> ExportTableToPointInTime
s {$sel:s3Prefix:ExportTableToPointInTime' :: Maybe Text
s3Prefix = Maybe Text
a} :: ExportTableToPointInTime)

-- | The Amazon Resource Name (ARN) associated with the table to export.
exportTableToPointInTime_tableArn :: Lens.Lens' ExportTableToPointInTime Prelude.Text
exportTableToPointInTime_tableArn :: (Text -> f Text)
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_tableArn = (ExportTableToPointInTime -> Text)
-> (ExportTableToPointInTime -> Text -> ExportTableToPointInTime)
-> Lens ExportTableToPointInTime ExportTableToPointInTime Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Text
tableArn :: Text
$sel:tableArn:ExportTableToPointInTime' :: ExportTableToPointInTime -> Text
tableArn} -> Text
tableArn) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Text
a -> ExportTableToPointInTime
s {$sel:tableArn:ExportTableToPointInTime' :: Text
tableArn = Text
a} :: ExportTableToPointInTime)

-- | The name of the Amazon S3 bucket to export the snapshot to.
exportTableToPointInTime_s3Bucket :: Lens.Lens' ExportTableToPointInTime Prelude.Text
exportTableToPointInTime_s3Bucket :: (Text -> f Text)
-> ExportTableToPointInTime -> f ExportTableToPointInTime
exportTableToPointInTime_s3Bucket = (ExportTableToPointInTime -> Text)
-> (ExportTableToPointInTime -> Text -> ExportTableToPointInTime)
-> Lens ExportTableToPointInTime ExportTableToPointInTime Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTime' {Text
s3Bucket :: Text
$sel:s3Bucket:ExportTableToPointInTime' :: ExportTableToPointInTime -> Text
s3Bucket} -> Text
s3Bucket) (\s :: ExportTableToPointInTime
s@ExportTableToPointInTime' {} Text
a -> ExportTableToPointInTime
s {$sel:s3Bucket:ExportTableToPointInTime' :: Text
s3Bucket = Text
a} :: ExportTableToPointInTime)

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

instance Prelude.NFData ExportTableToPointInTime

instance Core.ToHeaders ExportTableToPointInTime where
  toHeaders :: ExportTableToPointInTime -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ExportTableToPointInTime -> 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.ExportTableToPointInTime" ::
                          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 ExportTableToPointInTime where
  toJSON :: ExportTableToPointInTime -> Value
toJSON ExportTableToPointInTime' {Maybe Text
Maybe POSIX
Maybe ExportFormat
Maybe S3SseAlgorithm
Text
s3Bucket :: Text
tableArn :: Text
s3Prefix :: Maybe Text
s3SseAlgorithm :: Maybe S3SseAlgorithm
exportTime :: Maybe POSIX
clientToken :: Maybe Text
s3SseKmsKeyId :: Maybe Text
exportFormat :: Maybe ExportFormat
s3BucketOwner :: Maybe Text
$sel:s3Bucket:ExportTableToPointInTime' :: ExportTableToPointInTime -> Text
$sel:tableArn:ExportTableToPointInTime' :: ExportTableToPointInTime -> Text
$sel:s3Prefix:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe Text
$sel:s3SseAlgorithm:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe S3SseAlgorithm
$sel:exportTime:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe POSIX
$sel:clientToken:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe Text
$sel:s3SseKmsKeyId:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe Text
$sel:exportFormat:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe ExportFormat
$sel:s3BucketOwner:ExportTableToPointInTime' :: ExportTableToPointInTime -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"S3BucketOwner" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3BucketOwner,
            (Text
"ExportFormat" Text -> ExportFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ExportFormat -> Pair) -> Maybe ExportFormat -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExportFormat
exportFormat,
            (Text
"S3SseKmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3SseKmsKeyId,
            (Text
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Text
"ExportTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
exportTime,
            (Text
"S3SseAlgorithm" Text -> S3SseAlgorithm -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (S3SseAlgorithm -> Pair) -> Maybe S3SseAlgorithm -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3SseAlgorithm
s3SseAlgorithm,
            (Text
"S3Prefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3Prefix,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Bucket)
          ]
      )

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

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

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

-- |
-- Create a value of 'ExportTableToPointInTimeResponse' 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:
--
-- 'exportDescription', 'exportTableToPointInTimeResponse_exportDescription' - Contains a description of the table export.
--
-- 'httpStatus', 'exportTableToPointInTimeResponse_httpStatus' - The response's http status code.
newExportTableToPointInTimeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ExportTableToPointInTimeResponse
newExportTableToPointInTimeResponse :: Int -> ExportTableToPointInTimeResponse
newExportTableToPointInTimeResponse Int
pHttpStatus_ =
  ExportTableToPointInTimeResponse' :: Maybe ExportDescription -> Int -> ExportTableToPointInTimeResponse
ExportTableToPointInTimeResponse'
    { $sel:exportDescription:ExportTableToPointInTimeResponse' :: Maybe ExportDescription
exportDescription =
        Maybe ExportDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ExportTableToPointInTimeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Contains a description of the table export.
exportTableToPointInTimeResponse_exportDescription :: Lens.Lens' ExportTableToPointInTimeResponse (Prelude.Maybe ExportDescription)
exportTableToPointInTimeResponse_exportDescription :: (Maybe ExportDescription -> f (Maybe ExportDescription))
-> ExportTableToPointInTimeResponse
-> f ExportTableToPointInTimeResponse
exportTableToPointInTimeResponse_exportDescription = (ExportTableToPointInTimeResponse -> Maybe ExportDescription)
-> (ExportTableToPointInTimeResponse
    -> Maybe ExportDescription -> ExportTableToPointInTimeResponse)
-> Lens
     ExportTableToPointInTimeResponse
     ExportTableToPointInTimeResponse
     (Maybe ExportDescription)
     (Maybe ExportDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTableToPointInTimeResponse' {Maybe ExportDescription
exportDescription :: Maybe ExportDescription
$sel:exportDescription:ExportTableToPointInTimeResponse' :: ExportTableToPointInTimeResponse -> Maybe ExportDescription
exportDescription} -> Maybe ExportDescription
exportDescription) (\s :: ExportTableToPointInTimeResponse
s@ExportTableToPointInTimeResponse' {} Maybe ExportDescription
a -> ExportTableToPointInTimeResponse
s {$sel:exportDescription:ExportTableToPointInTimeResponse' :: Maybe ExportDescription
exportDescription = Maybe ExportDescription
a} :: ExportTableToPointInTimeResponse)

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

instance
  Prelude.NFData
    ExportTableToPointInTimeResponse