{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.ImportSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DynamoDB.Types.ImportSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.ImportStatus
import Amazonka.DynamoDB.Types.InputFormat
import Amazonka.DynamoDB.Types.S3BucketSource
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Summary information about the source file for the import.
--
-- /See:/ 'newImportSummary' smart constructor.
data ImportSummary = ImportSummary'
  { -- | The Amazon Resource Number (ARN) of the Cloudwatch Log Group associated
    -- with this import task.
    ImportSummary -> Maybe Text
cloudWatchLogGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The time at which this import task ended. (Does this include the
    -- successful complete creation of the table it was imported to?)
    ImportSummary -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | The Amazon Resource Number (ARN) corresponding to the import request.
    ImportSummary -> Maybe Text
importArn :: Prelude.Maybe Prelude.Text,
    -- | The status of the import operation.
    ImportSummary -> Maybe ImportStatus
importStatus :: Prelude.Maybe ImportStatus,
    -- | The format of the source data. Valid values are @CSV@, @DYNAMODB_JSON@
    -- or @ION@.
    ImportSummary -> Maybe InputFormat
inputFormat :: Prelude.Maybe InputFormat,
    -- | The path and S3 bucket of the source file that is being imported. This
    -- includes the S3Bucket (required), S3KeyPrefix (optional) and
    -- S3BucketOwner (optional if the bucket is owned by the requester).
    ImportSummary -> Maybe S3BucketSource
s3BucketSource :: Prelude.Maybe S3BucketSource,
    -- | The time at which this import task began.
    ImportSummary -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
    -- | The Amazon Resource Number (ARN) of the table being imported into.
    ImportSummary -> Maybe Text
tableArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ImportSummary -> ImportSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportSummary -> ImportSummary -> Bool
$c/= :: ImportSummary -> ImportSummary -> Bool
== :: ImportSummary -> ImportSummary -> Bool
$c== :: ImportSummary -> ImportSummary -> Bool
Prelude.Eq, ReadPrec [ImportSummary]
ReadPrec ImportSummary
Int -> ReadS ImportSummary
ReadS [ImportSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportSummary]
$creadListPrec :: ReadPrec [ImportSummary]
readPrec :: ReadPrec ImportSummary
$creadPrec :: ReadPrec ImportSummary
readList :: ReadS [ImportSummary]
$creadList :: ReadS [ImportSummary]
readsPrec :: Int -> ReadS ImportSummary
$creadsPrec :: Int -> ReadS ImportSummary
Prelude.Read, Int -> ImportSummary -> ShowS
[ImportSummary] -> ShowS
ImportSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportSummary] -> ShowS
$cshowList :: [ImportSummary] -> ShowS
show :: ImportSummary -> String
$cshow :: ImportSummary -> String
showsPrec :: Int -> ImportSummary -> ShowS
$cshowsPrec :: Int -> ImportSummary -> ShowS
Prelude.Show, forall x. Rep ImportSummary x -> ImportSummary
forall x. ImportSummary -> Rep ImportSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportSummary x -> ImportSummary
$cfrom :: forall x. ImportSummary -> Rep ImportSummary x
Prelude.Generic)

-- |
-- Create a value of 'ImportSummary' 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:
--
-- 'cloudWatchLogGroupArn', 'importSummary_cloudWatchLogGroupArn' - The Amazon Resource Number (ARN) of the Cloudwatch Log Group associated
-- with this import task.
--
-- 'endTime', 'importSummary_endTime' - The time at which this import task ended. (Does this include the
-- successful complete creation of the table it was imported to?)
--
-- 'importArn', 'importSummary_importArn' - The Amazon Resource Number (ARN) corresponding to the import request.
--
-- 'importStatus', 'importSummary_importStatus' - The status of the import operation.
--
-- 'inputFormat', 'importSummary_inputFormat' - The format of the source data. Valid values are @CSV@, @DYNAMODB_JSON@
-- or @ION@.
--
-- 's3BucketSource', 'importSummary_s3BucketSource' - The path and S3 bucket of the source file that is being imported. This
-- includes the S3Bucket (required), S3KeyPrefix (optional) and
-- S3BucketOwner (optional if the bucket is owned by the requester).
--
-- 'startTime', 'importSummary_startTime' - The time at which this import task began.
--
-- 'tableArn', 'importSummary_tableArn' - The Amazon Resource Number (ARN) of the table being imported into.
newImportSummary ::
  ImportSummary
newImportSummary :: ImportSummary
newImportSummary =
  ImportSummary'
    { $sel:cloudWatchLogGroupArn:ImportSummary' :: Maybe Text
cloudWatchLogGroupArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:ImportSummary' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:importArn:ImportSummary' :: Maybe Text
importArn = forall a. Maybe a
Prelude.Nothing,
      $sel:importStatus:ImportSummary' :: Maybe ImportStatus
importStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:inputFormat:ImportSummary' :: Maybe InputFormat
inputFormat = forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketSource:ImportSummary' :: Maybe S3BucketSource
s3BucketSource = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ImportSummary' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:tableArn:ImportSummary' :: Maybe Text
tableArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Number (ARN) of the Cloudwatch Log Group associated
-- with this import task.
importSummary_cloudWatchLogGroupArn :: Lens.Lens' ImportSummary (Prelude.Maybe Prelude.Text)
importSummary_cloudWatchLogGroupArn :: Lens' ImportSummary (Maybe Text)
importSummary_cloudWatchLogGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSummary' {Maybe Text
cloudWatchLogGroupArn :: Maybe Text
$sel:cloudWatchLogGroupArn:ImportSummary' :: ImportSummary -> Maybe Text
cloudWatchLogGroupArn} -> Maybe Text
cloudWatchLogGroupArn) (\s :: ImportSummary
s@ImportSummary' {} Maybe Text
a -> ImportSummary
s {$sel:cloudWatchLogGroupArn:ImportSummary' :: Maybe Text
cloudWatchLogGroupArn = Maybe Text
a} :: ImportSummary)

-- | The time at which this import task ended. (Does this include the
-- successful complete creation of the table it was imported to?)
importSummary_endTime :: Lens.Lens' ImportSummary (Prelude.Maybe Prelude.UTCTime)
importSummary_endTime :: Lens' ImportSummary (Maybe UTCTime)
importSummary_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSummary' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:ImportSummary' :: ImportSummary -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: ImportSummary
s@ImportSummary' {} Maybe POSIX
a -> ImportSummary
s {$sel:endTime:ImportSummary' :: Maybe POSIX
endTime = Maybe POSIX
a} :: ImportSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Amazon Resource Number (ARN) corresponding to the import request.
importSummary_importArn :: Lens.Lens' ImportSummary (Prelude.Maybe Prelude.Text)
importSummary_importArn :: Lens' ImportSummary (Maybe Text)
importSummary_importArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSummary' {Maybe Text
importArn :: Maybe Text
$sel:importArn:ImportSummary' :: ImportSummary -> Maybe Text
importArn} -> Maybe Text
importArn) (\s :: ImportSummary
s@ImportSummary' {} Maybe Text
a -> ImportSummary
s {$sel:importArn:ImportSummary' :: Maybe Text
importArn = Maybe Text
a} :: ImportSummary)

-- | The status of the import operation.
importSummary_importStatus :: Lens.Lens' ImportSummary (Prelude.Maybe ImportStatus)
importSummary_importStatus :: Lens' ImportSummary (Maybe ImportStatus)
importSummary_importStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSummary' {Maybe ImportStatus
importStatus :: Maybe ImportStatus
$sel:importStatus:ImportSummary' :: ImportSummary -> Maybe ImportStatus
importStatus} -> Maybe ImportStatus
importStatus) (\s :: ImportSummary
s@ImportSummary' {} Maybe ImportStatus
a -> ImportSummary
s {$sel:importStatus:ImportSummary' :: Maybe ImportStatus
importStatus = Maybe ImportStatus
a} :: ImportSummary)

-- | The format of the source data. Valid values are @CSV@, @DYNAMODB_JSON@
-- or @ION@.
importSummary_inputFormat :: Lens.Lens' ImportSummary (Prelude.Maybe InputFormat)
importSummary_inputFormat :: Lens' ImportSummary (Maybe InputFormat)
importSummary_inputFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSummary' {Maybe InputFormat
inputFormat :: Maybe InputFormat
$sel:inputFormat:ImportSummary' :: ImportSummary -> Maybe InputFormat
inputFormat} -> Maybe InputFormat
inputFormat) (\s :: ImportSummary
s@ImportSummary' {} Maybe InputFormat
a -> ImportSummary
s {$sel:inputFormat:ImportSummary' :: Maybe InputFormat
inputFormat = Maybe InputFormat
a} :: ImportSummary)

-- | The path and S3 bucket of the source file that is being imported. This
-- includes the S3Bucket (required), S3KeyPrefix (optional) and
-- S3BucketOwner (optional if the bucket is owned by the requester).
importSummary_s3BucketSource :: Lens.Lens' ImportSummary (Prelude.Maybe S3BucketSource)
importSummary_s3BucketSource :: Lens' ImportSummary (Maybe S3BucketSource)
importSummary_s3BucketSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSummary' {Maybe S3BucketSource
s3BucketSource :: Maybe S3BucketSource
$sel:s3BucketSource:ImportSummary' :: ImportSummary -> Maybe S3BucketSource
s3BucketSource} -> Maybe S3BucketSource
s3BucketSource) (\s :: ImportSummary
s@ImportSummary' {} Maybe S3BucketSource
a -> ImportSummary
s {$sel:s3BucketSource:ImportSummary' :: Maybe S3BucketSource
s3BucketSource = Maybe S3BucketSource
a} :: ImportSummary)

-- | The time at which this import task began.
importSummary_startTime :: Lens.Lens' ImportSummary (Prelude.Maybe Prelude.UTCTime)
importSummary_startTime :: Lens' ImportSummary (Maybe UTCTime)
importSummary_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSummary' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:ImportSummary' :: ImportSummary -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: ImportSummary
s@ImportSummary' {} Maybe POSIX
a -> ImportSummary
s {$sel:startTime:ImportSummary' :: Maybe POSIX
startTime = Maybe POSIX
a} :: ImportSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Amazon Resource Number (ARN) of the table being imported into.
importSummary_tableArn :: Lens.Lens' ImportSummary (Prelude.Maybe Prelude.Text)
importSummary_tableArn :: Lens' ImportSummary (Maybe Text)
importSummary_tableArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportSummary' {Maybe Text
tableArn :: Maybe Text
$sel:tableArn:ImportSummary' :: ImportSummary -> Maybe Text
tableArn} -> Maybe Text
tableArn) (\s :: ImportSummary
s@ImportSummary' {} Maybe Text
a -> ImportSummary
s {$sel:tableArn:ImportSummary' :: Maybe Text
tableArn = Maybe Text
a} :: ImportSummary)

instance Data.FromJSON ImportSummary where
  parseJSON :: Value -> Parser ImportSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ImportSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe ImportStatus
-> Maybe InputFormat
-> Maybe S3BucketSource
-> Maybe POSIX
-> Maybe Text
-> ImportSummary
ImportSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CloudWatchLogGroupArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EndTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ImportArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ImportStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InputFormat")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"S3BucketSource")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StartTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TableArn")
      )

instance Prelude.Hashable ImportSummary where
  hashWithSalt :: Int -> ImportSummary -> Int
hashWithSalt Int
_salt ImportSummary' {Maybe Text
Maybe POSIX
Maybe S3BucketSource
Maybe InputFormat
Maybe ImportStatus
tableArn :: Maybe Text
startTime :: Maybe POSIX
s3BucketSource :: Maybe S3BucketSource
inputFormat :: Maybe InputFormat
importStatus :: Maybe ImportStatus
importArn :: Maybe Text
endTime :: Maybe POSIX
cloudWatchLogGroupArn :: Maybe Text
$sel:tableArn:ImportSummary' :: ImportSummary -> Maybe Text
$sel:startTime:ImportSummary' :: ImportSummary -> Maybe POSIX
$sel:s3BucketSource:ImportSummary' :: ImportSummary -> Maybe S3BucketSource
$sel:inputFormat:ImportSummary' :: ImportSummary -> Maybe InputFormat
$sel:importStatus:ImportSummary' :: ImportSummary -> Maybe ImportStatus
$sel:importArn:ImportSummary' :: ImportSummary -> Maybe Text
$sel:endTime:ImportSummary' :: ImportSummary -> Maybe POSIX
$sel:cloudWatchLogGroupArn:ImportSummary' :: ImportSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cloudWatchLogGroupArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
importArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImportStatus
importStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputFormat
inputFormat
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3BucketSource
s3BucketSource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
tableArn

instance Prelude.NFData ImportSummary where
  rnf :: ImportSummary -> ()
rnf ImportSummary' {Maybe Text
Maybe POSIX
Maybe S3BucketSource
Maybe InputFormat
Maybe ImportStatus
tableArn :: Maybe Text
startTime :: Maybe POSIX
s3BucketSource :: Maybe S3BucketSource
inputFormat :: Maybe InputFormat
importStatus :: Maybe ImportStatus
importArn :: Maybe Text
endTime :: Maybe POSIX
cloudWatchLogGroupArn :: Maybe Text
$sel:tableArn:ImportSummary' :: ImportSummary -> Maybe Text
$sel:startTime:ImportSummary' :: ImportSummary -> Maybe POSIX
$sel:s3BucketSource:ImportSummary' :: ImportSummary -> Maybe S3BucketSource
$sel:inputFormat:ImportSummary' :: ImportSummary -> Maybe InputFormat
$sel:importStatus:ImportSummary' :: ImportSummary -> Maybe ImportStatus
$sel:importArn:ImportSummary' :: ImportSummary -> Maybe Text
$sel:endTime:ImportSummary' :: ImportSummary -> Maybe POSIX
$sel:cloudWatchLogGroupArn:ImportSummary' :: ImportSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cloudWatchLogGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
importArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImportStatus
importStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InputFormat
inputFormat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3BucketSource
s3BucketSource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tableArn