{-# 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.CompletedPart
-- 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)
module Amazonka.S3.Types.CompletedPart where

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

-- | Details of the parts that were uploaded.
--
-- /See:/ 'newCompletedPart' smart constructor.
data CompletedPart = CompletedPart'
  { -- | Part number that identifies the part. This is a positive integer between
    -- 1 and 10,000.
    CompletedPart -> Int
partNumber :: Prelude.Int,
    -- | Entity tag returned when the part was uploaded.
    CompletedPart -> ETag
eTag :: ETag
  }
  deriving (CompletedPart -> CompletedPart -> Bool
(CompletedPart -> CompletedPart -> Bool)
-> (CompletedPart -> CompletedPart -> Bool) -> Eq CompletedPart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompletedPart -> CompletedPart -> Bool
$c/= :: CompletedPart -> CompletedPart -> Bool
== :: CompletedPart -> CompletedPart -> Bool
$c== :: CompletedPart -> CompletedPart -> Bool
Prelude.Eq, ReadPrec [CompletedPart]
ReadPrec CompletedPart
Int -> ReadS CompletedPart
ReadS [CompletedPart]
(Int -> ReadS CompletedPart)
-> ReadS [CompletedPart]
-> ReadPrec CompletedPart
-> ReadPrec [CompletedPart]
-> Read CompletedPart
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompletedPart]
$creadListPrec :: ReadPrec [CompletedPart]
readPrec :: ReadPrec CompletedPart
$creadPrec :: ReadPrec CompletedPart
readList :: ReadS [CompletedPart]
$creadList :: ReadS [CompletedPart]
readsPrec :: Int -> ReadS CompletedPart
$creadsPrec :: Int -> ReadS CompletedPart
Prelude.Read, Int -> CompletedPart -> ShowS
[CompletedPart] -> ShowS
CompletedPart -> String
(Int -> CompletedPart -> ShowS)
-> (CompletedPart -> String)
-> ([CompletedPart] -> ShowS)
-> Show CompletedPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompletedPart] -> ShowS
$cshowList :: [CompletedPart] -> ShowS
show :: CompletedPart -> String
$cshow :: CompletedPart -> String
showsPrec :: Int -> CompletedPart -> ShowS
$cshowsPrec :: Int -> CompletedPart -> ShowS
Prelude.Show, (forall x. CompletedPart -> Rep CompletedPart x)
-> (forall x. Rep CompletedPart x -> CompletedPart)
-> Generic CompletedPart
forall x. Rep CompletedPart x -> CompletedPart
forall x. CompletedPart -> Rep CompletedPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompletedPart x -> CompletedPart
$cfrom :: forall x. CompletedPart -> Rep CompletedPart x
Prelude.Generic)

-- |
-- Create a value of 'CompletedPart' 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:
--
-- 'partNumber', 'completedPart_partNumber' - Part number that identifies the part. This is a positive integer between
-- 1 and 10,000.
--
-- 'eTag', 'completedPart_eTag' - Entity tag returned when the part was uploaded.
newCompletedPart ::
  -- | 'partNumber'
  Prelude.Int ->
  -- | 'eTag'
  ETag ->
  CompletedPart
newCompletedPart :: Int -> ETag -> CompletedPart
newCompletedPart Int
pPartNumber_ ETag
pETag_ =
  CompletedPart' :: Int -> ETag -> CompletedPart
CompletedPart'
    { $sel:partNumber:CompletedPart' :: Int
partNumber = Int
pPartNumber_,
      $sel:eTag:CompletedPart' :: ETag
eTag = ETag
pETag_
    }

-- | Part number that identifies the part. This is a positive integer between
-- 1 and 10,000.
completedPart_partNumber :: Lens.Lens' CompletedPart Prelude.Int
completedPart_partNumber :: (Int -> f Int) -> CompletedPart -> f CompletedPart
completedPart_partNumber = (CompletedPart -> Int)
-> (CompletedPart -> Int -> CompletedPart)
-> Lens CompletedPart CompletedPart Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompletedPart' {Int
partNumber :: Int
$sel:partNumber:CompletedPart' :: CompletedPart -> Int
partNumber} -> Int
partNumber) (\s :: CompletedPart
s@CompletedPart' {} Int
a -> CompletedPart
s {$sel:partNumber:CompletedPart' :: Int
partNumber = Int
a} :: CompletedPart)

-- | Entity tag returned when the part was uploaded.
completedPart_eTag :: Lens.Lens' CompletedPart ETag
completedPart_eTag :: (ETag -> f ETag) -> CompletedPart -> f CompletedPart
completedPart_eTag = (CompletedPart -> ETag)
-> (CompletedPart -> ETag -> CompletedPart)
-> Lens CompletedPart CompletedPart ETag ETag
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompletedPart' {ETag
eTag :: ETag
$sel:eTag:CompletedPart' :: CompletedPart -> ETag
eTag} -> ETag
eTag) (\s :: CompletedPart
s@CompletedPart' {} ETag
a -> CompletedPart
s {$sel:eTag:CompletedPart' :: ETag
eTag = ETag
a} :: CompletedPart)

instance Prelude.Hashable CompletedPart

instance Prelude.NFData CompletedPart

instance Core.ToXML CompletedPart where
  toXML :: CompletedPart -> XML
toXML CompletedPart' {Int
ETag
eTag :: ETag
partNumber :: Int
$sel:eTag:CompletedPart' :: CompletedPart -> ETag
$sel:partNumber:CompletedPart' :: CompletedPart -> Int
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"PartNumber" Name -> Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Int
partNumber,
        Name
"ETag" Name -> ETag -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= ETag
eTag
      ]