{-# 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.Glacier.Types.UploadListElement
-- 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.Glacier.Types.UploadListElement where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A list of in-progress multipart uploads for a vault.
--
-- /See:/ 'newUploadListElement' smart constructor.
data UploadListElement = UploadListElement'
  { -- | The description of the archive that was specified in the Initiate
    -- Multipart Upload request.
    UploadListElement -> Maybe Text
archiveDescription :: Prelude.Maybe Prelude.Text,
    -- | The UTC time at which the multipart upload was initiated.
    UploadListElement -> Maybe Text
creationDate :: Prelude.Maybe Prelude.Text,
    -- | The ID of a multipart upload.
    UploadListElement -> Maybe Text
multipartUploadId :: Prelude.Maybe Prelude.Text,
    -- | The part size, in bytes, specified in the Initiate Multipart Upload
    -- request. This is the size of all the parts in the upload except the last
    -- part, which may be smaller than this size.
    UploadListElement -> Maybe Integer
partSizeInBytes :: Prelude.Maybe Prelude.Integer,
    -- | The Amazon Resource Name (ARN) of the vault that contains the archive.
    UploadListElement -> Maybe Text
vaultARN :: Prelude.Maybe Prelude.Text
  }
  deriving (UploadListElement -> UploadListElement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UploadListElement -> UploadListElement -> Bool
$c/= :: UploadListElement -> UploadListElement -> Bool
== :: UploadListElement -> UploadListElement -> Bool
$c== :: UploadListElement -> UploadListElement -> Bool
Prelude.Eq, ReadPrec [UploadListElement]
ReadPrec UploadListElement
Int -> ReadS UploadListElement
ReadS [UploadListElement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UploadListElement]
$creadListPrec :: ReadPrec [UploadListElement]
readPrec :: ReadPrec UploadListElement
$creadPrec :: ReadPrec UploadListElement
readList :: ReadS [UploadListElement]
$creadList :: ReadS [UploadListElement]
readsPrec :: Int -> ReadS UploadListElement
$creadsPrec :: Int -> ReadS UploadListElement
Prelude.Read, Int -> UploadListElement -> ShowS
[UploadListElement] -> ShowS
UploadListElement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadListElement] -> ShowS
$cshowList :: [UploadListElement] -> ShowS
show :: UploadListElement -> String
$cshow :: UploadListElement -> String
showsPrec :: Int -> UploadListElement -> ShowS
$cshowsPrec :: Int -> UploadListElement -> ShowS
Prelude.Show, forall x. Rep UploadListElement x -> UploadListElement
forall x. UploadListElement -> Rep UploadListElement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploadListElement x -> UploadListElement
$cfrom :: forall x. UploadListElement -> Rep UploadListElement x
Prelude.Generic)

-- |
-- Create a value of 'UploadListElement' 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:
--
-- 'archiveDescription', 'uploadListElement_archiveDescription' - The description of the archive that was specified in the Initiate
-- Multipart Upload request.
--
-- 'creationDate', 'uploadListElement_creationDate' - The UTC time at which the multipart upload was initiated.
--
-- 'multipartUploadId', 'uploadListElement_multipartUploadId' - The ID of a multipart upload.
--
-- 'partSizeInBytes', 'uploadListElement_partSizeInBytes' - The part size, in bytes, specified in the Initiate Multipart Upload
-- request. This is the size of all the parts in the upload except the last
-- part, which may be smaller than this size.
--
-- 'vaultARN', 'uploadListElement_vaultARN' - The Amazon Resource Name (ARN) of the vault that contains the archive.
newUploadListElement ::
  UploadListElement
newUploadListElement :: UploadListElement
newUploadListElement =
  UploadListElement'
    { $sel:archiveDescription:UploadListElement' :: Maybe Text
archiveDescription =
        forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:UploadListElement' :: Maybe Text
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:multipartUploadId:UploadListElement' :: Maybe Text
multipartUploadId = forall a. Maybe a
Prelude.Nothing,
      $sel:partSizeInBytes:UploadListElement' :: Maybe Integer
partSizeInBytes = forall a. Maybe a
Prelude.Nothing,
      $sel:vaultARN:UploadListElement' :: Maybe Text
vaultARN = forall a. Maybe a
Prelude.Nothing
    }

-- | The description of the archive that was specified in the Initiate
-- Multipart Upload request.
uploadListElement_archiveDescription :: Lens.Lens' UploadListElement (Prelude.Maybe Prelude.Text)
uploadListElement_archiveDescription :: Lens' UploadListElement (Maybe Text)
uploadListElement_archiveDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadListElement' {Maybe Text
archiveDescription :: Maybe Text
$sel:archiveDescription:UploadListElement' :: UploadListElement -> Maybe Text
archiveDescription} -> Maybe Text
archiveDescription) (\s :: UploadListElement
s@UploadListElement' {} Maybe Text
a -> UploadListElement
s {$sel:archiveDescription:UploadListElement' :: Maybe Text
archiveDescription = Maybe Text
a} :: UploadListElement)

-- | The UTC time at which the multipart upload was initiated.
uploadListElement_creationDate :: Lens.Lens' UploadListElement (Prelude.Maybe Prelude.Text)
uploadListElement_creationDate :: Lens' UploadListElement (Maybe Text)
uploadListElement_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadListElement' {Maybe Text
creationDate :: Maybe Text
$sel:creationDate:UploadListElement' :: UploadListElement -> Maybe Text
creationDate} -> Maybe Text
creationDate) (\s :: UploadListElement
s@UploadListElement' {} Maybe Text
a -> UploadListElement
s {$sel:creationDate:UploadListElement' :: Maybe Text
creationDate = Maybe Text
a} :: UploadListElement)

-- | The ID of a multipart upload.
uploadListElement_multipartUploadId :: Lens.Lens' UploadListElement (Prelude.Maybe Prelude.Text)
uploadListElement_multipartUploadId :: Lens' UploadListElement (Maybe Text)
uploadListElement_multipartUploadId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadListElement' {Maybe Text
multipartUploadId :: Maybe Text
$sel:multipartUploadId:UploadListElement' :: UploadListElement -> Maybe Text
multipartUploadId} -> Maybe Text
multipartUploadId) (\s :: UploadListElement
s@UploadListElement' {} Maybe Text
a -> UploadListElement
s {$sel:multipartUploadId:UploadListElement' :: Maybe Text
multipartUploadId = Maybe Text
a} :: UploadListElement)

-- | The part size, in bytes, specified in the Initiate Multipart Upload
-- request. This is the size of all the parts in the upload except the last
-- part, which may be smaller than this size.
uploadListElement_partSizeInBytes :: Lens.Lens' UploadListElement (Prelude.Maybe Prelude.Integer)
uploadListElement_partSizeInBytes :: Lens' UploadListElement (Maybe Integer)
uploadListElement_partSizeInBytes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadListElement' {Maybe Integer
partSizeInBytes :: Maybe Integer
$sel:partSizeInBytes:UploadListElement' :: UploadListElement -> Maybe Integer
partSizeInBytes} -> Maybe Integer
partSizeInBytes) (\s :: UploadListElement
s@UploadListElement' {} Maybe Integer
a -> UploadListElement
s {$sel:partSizeInBytes:UploadListElement' :: Maybe Integer
partSizeInBytes = Maybe Integer
a} :: UploadListElement)

-- | The Amazon Resource Name (ARN) of the vault that contains the archive.
uploadListElement_vaultARN :: Lens.Lens' UploadListElement (Prelude.Maybe Prelude.Text)
uploadListElement_vaultARN :: Lens' UploadListElement (Maybe Text)
uploadListElement_vaultARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadListElement' {Maybe Text
vaultARN :: Maybe Text
$sel:vaultARN:UploadListElement' :: UploadListElement -> Maybe Text
vaultARN} -> Maybe Text
vaultARN) (\s :: UploadListElement
s@UploadListElement' {} Maybe Text
a -> UploadListElement
s {$sel:vaultARN:UploadListElement' :: Maybe Text
vaultARN = Maybe Text
a} :: UploadListElement)

instance Data.FromJSON UploadListElement where
  parseJSON :: Value -> Parser UploadListElement
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UploadListElement"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> UploadListElement
UploadListElement'
            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
"ArchiveDescription")
            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
"CreationDate")
            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
"MultipartUploadId")
            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
"PartSizeInBytes")
            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
"VaultARN")
      )

instance Prelude.Hashable UploadListElement where
  hashWithSalt :: Int -> UploadListElement -> Int
hashWithSalt Int
_salt UploadListElement' {Maybe Integer
Maybe Text
vaultARN :: Maybe Text
partSizeInBytes :: Maybe Integer
multipartUploadId :: Maybe Text
creationDate :: Maybe Text
archiveDescription :: Maybe Text
$sel:vaultARN:UploadListElement' :: UploadListElement -> Maybe Text
$sel:partSizeInBytes:UploadListElement' :: UploadListElement -> Maybe Integer
$sel:multipartUploadId:UploadListElement' :: UploadListElement -> Maybe Text
$sel:creationDate:UploadListElement' :: UploadListElement -> Maybe Text
$sel:archiveDescription:UploadListElement' :: UploadListElement -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
archiveDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
multipartUploadId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
partSizeInBytes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vaultARN

instance Prelude.NFData UploadListElement where
  rnf :: UploadListElement -> ()
rnf UploadListElement' {Maybe Integer
Maybe Text
vaultARN :: Maybe Text
partSizeInBytes :: Maybe Integer
multipartUploadId :: Maybe Text
creationDate :: Maybe Text
archiveDescription :: Maybe Text
$sel:vaultARN:UploadListElement' :: UploadListElement -> Maybe Text
$sel:partSizeInBytes:UploadListElement' :: UploadListElement -> Maybe Integer
$sel:multipartUploadId:UploadListElement' :: UploadListElement -> Maybe Text
$sel:creationDate:UploadListElement' :: UploadListElement -> Maybe Text
$sel:archiveDescription:UploadListElement' :: UploadListElement -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
archiveDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
multipartUploadId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
partSizeInBytes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vaultARN