{-# 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.S3.Types.GetObjectAttributesParts
-- 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.S3.Types.GetObjectAttributesParts 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
import Amazonka.S3.Internal
import Amazonka.S3.Types.ObjectPart

-- | A collection of parts associated with a multipart upload.
--
-- /See:/ 'newGetObjectAttributesParts' smart constructor.
data GetObjectAttributesParts = GetObjectAttributesParts'
  { -- | Indicates whether the returned list of parts is truncated. A value of
    -- @true@ indicates that the list was truncated. A list can be truncated if
    -- the number of parts exceeds the limit returned in the @MaxParts@
    -- element.
    GetObjectAttributesParts -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | The maximum number of parts allowed in the response.
    GetObjectAttributesParts -> Maybe Int
maxParts :: Prelude.Maybe Prelude.Int,
    -- | When a list is truncated, this element specifies the last part in the
    -- list, as well as the value to use for the @PartNumberMarker@ request
    -- parameter in a subsequent request.
    GetObjectAttributesParts -> Maybe Int
nextPartNumberMarker :: Prelude.Maybe Prelude.Int,
    -- | The marker for the current part.
    GetObjectAttributesParts -> Maybe Int
partNumberMarker :: Prelude.Maybe Prelude.Int,
    -- | A container for elements related to a particular part. A response can
    -- contain zero or more @Parts@ elements.
    GetObjectAttributesParts -> Maybe [ObjectPart]
parts :: Prelude.Maybe [ObjectPart],
    -- | The total number of parts.
    GetObjectAttributesParts -> Maybe Int
totalPartsCount :: Prelude.Maybe Prelude.Int
  }
  deriving (GetObjectAttributesParts -> GetObjectAttributesParts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetObjectAttributesParts -> GetObjectAttributesParts -> Bool
$c/= :: GetObjectAttributesParts -> GetObjectAttributesParts -> Bool
== :: GetObjectAttributesParts -> GetObjectAttributesParts -> Bool
$c== :: GetObjectAttributesParts -> GetObjectAttributesParts -> Bool
Prelude.Eq, ReadPrec [GetObjectAttributesParts]
ReadPrec GetObjectAttributesParts
Int -> ReadS GetObjectAttributesParts
ReadS [GetObjectAttributesParts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetObjectAttributesParts]
$creadListPrec :: ReadPrec [GetObjectAttributesParts]
readPrec :: ReadPrec GetObjectAttributesParts
$creadPrec :: ReadPrec GetObjectAttributesParts
readList :: ReadS [GetObjectAttributesParts]
$creadList :: ReadS [GetObjectAttributesParts]
readsPrec :: Int -> ReadS GetObjectAttributesParts
$creadsPrec :: Int -> ReadS GetObjectAttributesParts
Prelude.Read, Int -> GetObjectAttributesParts -> ShowS
[GetObjectAttributesParts] -> ShowS
GetObjectAttributesParts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectAttributesParts] -> ShowS
$cshowList :: [GetObjectAttributesParts] -> ShowS
show :: GetObjectAttributesParts -> String
$cshow :: GetObjectAttributesParts -> String
showsPrec :: Int -> GetObjectAttributesParts -> ShowS
$cshowsPrec :: Int -> GetObjectAttributesParts -> ShowS
Prelude.Show, forall x.
Rep GetObjectAttributesParts x -> GetObjectAttributesParts
forall x.
GetObjectAttributesParts -> Rep GetObjectAttributesParts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetObjectAttributesParts x -> GetObjectAttributesParts
$cfrom :: forall x.
GetObjectAttributesParts -> Rep GetObjectAttributesParts x
Prelude.Generic)

-- |
-- Create a value of 'GetObjectAttributesParts' 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:
--
-- 'isTruncated', 'getObjectAttributesParts_isTruncated' - Indicates whether the returned list of parts is truncated. A value of
-- @true@ indicates that the list was truncated. A list can be truncated if
-- the number of parts exceeds the limit returned in the @MaxParts@
-- element.
--
-- 'maxParts', 'getObjectAttributesParts_maxParts' - The maximum number of parts allowed in the response.
--
-- 'nextPartNumberMarker', 'getObjectAttributesParts_nextPartNumberMarker' - When a list is truncated, this element specifies the last part in the
-- list, as well as the value to use for the @PartNumberMarker@ request
-- parameter in a subsequent request.
--
-- 'partNumberMarker', 'getObjectAttributesParts_partNumberMarker' - The marker for the current part.
--
-- 'parts', 'getObjectAttributesParts_parts' - A container for elements related to a particular part. A response can
-- contain zero or more @Parts@ elements.
--
-- 'totalPartsCount', 'getObjectAttributesParts_totalPartsCount' - The total number of parts.
newGetObjectAttributesParts ::
  GetObjectAttributesParts
newGetObjectAttributesParts :: GetObjectAttributesParts
newGetObjectAttributesParts =
  GetObjectAttributesParts'
    { $sel:isTruncated:GetObjectAttributesParts' :: Maybe Bool
isTruncated =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxParts:GetObjectAttributesParts' :: Maybe Int
maxParts = forall a. Maybe a
Prelude.Nothing,
      $sel:nextPartNumberMarker:GetObjectAttributesParts' :: Maybe Int
nextPartNumberMarker = forall a. Maybe a
Prelude.Nothing,
      $sel:partNumberMarker:GetObjectAttributesParts' :: Maybe Int
partNumberMarker = forall a. Maybe a
Prelude.Nothing,
      $sel:parts:GetObjectAttributesParts' :: Maybe [ObjectPart]
parts = forall a. Maybe a
Prelude.Nothing,
      $sel:totalPartsCount:GetObjectAttributesParts' :: Maybe Int
totalPartsCount = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether the returned list of parts is truncated. A value of
-- @true@ indicates that the list was truncated. A list can be truncated if
-- the number of parts exceeds the limit returned in the @MaxParts@
-- element.
getObjectAttributesParts_isTruncated :: Lens.Lens' GetObjectAttributesParts (Prelude.Maybe Prelude.Bool)
getObjectAttributesParts_isTruncated :: Lens' GetObjectAttributesParts (Maybe Bool)
getObjectAttributesParts_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectAttributesParts' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: GetObjectAttributesParts
s@GetObjectAttributesParts' {} Maybe Bool
a -> GetObjectAttributesParts
s {$sel:isTruncated:GetObjectAttributesParts' :: Maybe Bool
isTruncated = Maybe Bool
a} :: GetObjectAttributesParts)

-- | The maximum number of parts allowed in the response.
getObjectAttributesParts_maxParts :: Lens.Lens' GetObjectAttributesParts (Prelude.Maybe Prelude.Int)
getObjectAttributesParts_maxParts :: Lens' GetObjectAttributesParts (Maybe Int)
getObjectAttributesParts_maxParts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectAttributesParts' {Maybe Int
maxParts :: Maybe Int
$sel:maxParts:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
maxParts} -> Maybe Int
maxParts) (\s :: GetObjectAttributesParts
s@GetObjectAttributesParts' {} Maybe Int
a -> GetObjectAttributesParts
s {$sel:maxParts:GetObjectAttributesParts' :: Maybe Int
maxParts = Maybe Int
a} :: GetObjectAttributesParts)

-- | When a list is truncated, this element specifies the last part in the
-- list, as well as the value to use for the @PartNumberMarker@ request
-- parameter in a subsequent request.
getObjectAttributesParts_nextPartNumberMarker :: Lens.Lens' GetObjectAttributesParts (Prelude.Maybe Prelude.Int)
getObjectAttributesParts_nextPartNumberMarker :: Lens' GetObjectAttributesParts (Maybe Int)
getObjectAttributesParts_nextPartNumberMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectAttributesParts' {Maybe Int
nextPartNumberMarker :: Maybe Int
$sel:nextPartNumberMarker:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
nextPartNumberMarker} -> Maybe Int
nextPartNumberMarker) (\s :: GetObjectAttributesParts
s@GetObjectAttributesParts' {} Maybe Int
a -> GetObjectAttributesParts
s {$sel:nextPartNumberMarker:GetObjectAttributesParts' :: Maybe Int
nextPartNumberMarker = Maybe Int
a} :: GetObjectAttributesParts)

-- | The marker for the current part.
getObjectAttributesParts_partNumberMarker :: Lens.Lens' GetObjectAttributesParts (Prelude.Maybe Prelude.Int)
getObjectAttributesParts_partNumberMarker :: Lens' GetObjectAttributesParts (Maybe Int)
getObjectAttributesParts_partNumberMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectAttributesParts' {Maybe Int
partNumberMarker :: Maybe Int
$sel:partNumberMarker:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
partNumberMarker} -> Maybe Int
partNumberMarker) (\s :: GetObjectAttributesParts
s@GetObjectAttributesParts' {} Maybe Int
a -> GetObjectAttributesParts
s {$sel:partNumberMarker:GetObjectAttributesParts' :: Maybe Int
partNumberMarker = Maybe Int
a} :: GetObjectAttributesParts)

-- | A container for elements related to a particular part. A response can
-- contain zero or more @Parts@ elements.
getObjectAttributesParts_parts :: Lens.Lens' GetObjectAttributesParts (Prelude.Maybe [ObjectPart])
getObjectAttributesParts_parts :: Lens' GetObjectAttributesParts (Maybe [ObjectPart])
getObjectAttributesParts_parts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectAttributesParts' {Maybe [ObjectPart]
parts :: Maybe [ObjectPart]
$sel:parts:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe [ObjectPart]
parts} -> Maybe [ObjectPart]
parts) (\s :: GetObjectAttributesParts
s@GetObjectAttributesParts' {} Maybe [ObjectPart]
a -> GetObjectAttributesParts
s {$sel:parts:GetObjectAttributesParts' :: Maybe [ObjectPart]
parts = Maybe [ObjectPart]
a} :: GetObjectAttributesParts) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The total number of parts.
getObjectAttributesParts_totalPartsCount :: Lens.Lens' GetObjectAttributesParts (Prelude.Maybe Prelude.Int)
getObjectAttributesParts_totalPartsCount :: Lens' GetObjectAttributesParts (Maybe Int)
getObjectAttributesParts_totalPartsCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectAttributesParts' {Maybe Int
totalPartsCount :: Maybe Int
$sel:totalPartsCount:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
totalPartsCount} -> Maybe Int
totalPartsCount) (\s :: GetObjectAttributesParts
s@GetObjectAttributesParts' {} Maybe Int
a -> GetObjectAttributesParts
s {$sel:totalPartsCount:GetObjectAttributesParts' :: Maybe Int
totalPartsCount = Maybe Int
a} :: GetObjectAttributesParts)

instance Data.FromXML GetObjectAttributesParts where
  parseXML :: [Node] -> Either String GetObjectAttributesParts
parseXML [Node]
x =
    Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe [ObjectPart]
-> Maybe Int
-> GetObjectAttributesParts
GetObjectAttributesParts'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsTruncated")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"MaxParts")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextPartNumberMarker")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PartNumberMarker")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"Part") [Node]
x)
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PartsCount")

instance Prelude.Hashable GetObjectAttributesParts where
  hashWithSalt :: Int -> GetObjectAttributesParts -> Int
hashWithSalt Int
_salt GetObjectAttributesParts' {Maybe Bool
Maybe Int
Maybe [ObjectPart]
totalPartsCount :: Maybe Int
parts :: Maybe [ObjectPart]
partNumberMarker :: Maybe Int
nextPartNumberMarker :: Maybe Int
maxParts :: Maybe Int
isTruncated :: Maybe Bool
$sel:totalPartsCount:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
$sel:parts:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe [ObjectPart]
$sel:partNumberMarker:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
$sel:nextPartNumberMarker:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
$sel:maxParts:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
$sel:isTruncated:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isTruncated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxParts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
nextPartNumberMarker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
partNumberMarker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ObjectPart]
parts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
totalPartsCount

instance Prelude.NFData GetObjectAttributesParts where
  rnf :: GetObjectAttributesParts -> ()
rnf GetObjectAttributesParts' {Maybe Bool
Maybe Int
Maybe [ObjectPart]
totalPartsCount :: Maybe Int
parts :: Maybe [ObjectPart]
partNumberMarker :: Maybe Int
nextPartNumberMarker :: Maybe Int
maxParts :: Maybe Int
isTruncated :: Maybe Bool
$sel:totalPartsCount:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
$sel:parts:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe [ObjectPart]
$sel:partNumberMarker:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
$sel:nextPartNumberMarker:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
$sel:maxParts:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Int
$sel:isTruncated:GetObjectAttributesParts' :: GetObjectAttributesParts -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isTruncated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxParts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
nextPartNumberMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
partNumberMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ObjectPart]
parts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
totalPartsCount