{-# 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.RequestPaymentConfiguration
-- 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.RequestPaymentConfiguration where

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

-- | Container for Payer.
--
-- /See:/ 'newRequestPaymentConfiguration' smart constructor.
data RequestPaymentConfiguration = RequestPaymentConfiguration'
  { -- | Specifies who pays for the download and request fees.
    RequestPaymentConfiguration -> Payer
payer :: Payer
  }
  deriving (RequestPaymentConfiguration -> RequestPaymentConfiguration -> Bool
(RequestPaymentConfiguration
 -> RequestPaymentConfiguration -> Bool)
-> (RequestPaymentConfiguration
    -> RequestPaymentConfiguration -> Bool)
-> Eq RequestPaymentConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestPaymentConfiguration -> RequestPaymentConfiguration -> Bool
$c/= :: RequestPaymentConfiguration -> RequestPaymentConfiguration -> Bool
== :: RequestPaymentConfiguration -> RequestPaymentConfiguration -> Bool
$c== :: RequestPaymentConfiguration -> RequestPaymentConfiguration -> Bool
Prelude.Eq, ReadPrec [RequestPaymentConfiguration]
ReadPrec RequestPaymentConfiguration
Int -> ReadS RequestPaymentConfiguration
ReadS [RequestPaymentConfiguration]
(Int -> ReadS RequestPaymentConfiguration)
-> ReadS [RequestPaymentConfiguration]
-> ReadPrec RequestPaymentConfiguration
-> ReadPrec [RequestPaymentConfiguration]
-> Read RequestPaymentConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequestPaymentConfiguration]
$creadListPrec :: ReadPrec [RequestPaymentConfiguration]
readPrec :: ReadPrec RequestPaymentConfiguration
$creadPrec :: ReadPrec RequestPaymentConfiguration
readList :: ReadS [RequestPaymentConfiguration]
$creadList :: ReadS [RequestPaymentConfiguration]
readsPrec :: Int -> ReadS RequestPaymentConfiguration
$creadsPrec :: Int -> ReadS RequestPaymentConfiguration
Prelude.Read, Int -> RequestPaymentConfiguration -> ShowS
[RequestPaymentConfiguration] -> ShowS
RequestPaymentConfiguration -> String
(Int -> RequestPaymentConfiguration -> ShowS)
-> (RequestPaymentConfiguration -> String)
-> ([RequestPaymentConfiguration] -> ShowS)
-> Show RequestPaymentConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestPaymentConfiguration] -> ShowS
$cshowList :: [RequestPaymentConfiguration] -> ShowS
show :: RequestPaymentConfiguration -> String
$cshow :: RequestPaymentConfiguration -> String
showsPrec :: Int -> RequestPaymentConfiguration -> ShowS
$cshowsPrec :: Int -> RequestPaymentConfiguration -> ShowS
Prelude.Show, (forall x.
 RequestPaymentConfiguration -> Rep RequestPaymentConfiguration x)
-> (forall x.
    Rep RequestPaymentConfiguration x -> RequestPaymentConfiguration)
-> Generic RequestPaymentConfiguration
forall x.
Rep RequestPaymentConfiguration x -> RequestPaymentConfiguration
forall x.
RequestPaymentConfiguration -> Rep RequestPaymentConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RequestPaymentConfiguration x -> RequestPaymentConfiguration
$cfrom :: forall x.
RequestPaymentConfiguration -> Rep RequestPaymentConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'RequestPaymentConfiguration' 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:
--
-- 'payer', 'requestPaymentConfiguration_payer' - Specifies who pays for the download and request fees.
newRequestPaymentConfiguration ::
  -- | 'payer'
  Payer ->
  RequestPaymentConfiguration
newRequestPaymentConfiguration :: Payer -> RequestPaymentConfiguration
newRequestPaymentConfiguration Payer
pPayer_ =
  RequestPaymentConfiguration' :: Payer -> RequestPaymentConfiguration
RequestPaymentConfiguration' {$sel:payer:RequestPaymentConfiguration' :: Payer
payer = Payer
pPayer_}

-- | Specifies who pays for the download and request fees.
requestPaymentConfiguration_payer :: Lens.Lens' RequestPaymentConfiguration Payer
requestPaymentConfiguration_payer :: (Payer -> f Payer)
-> RequestPaymentConfiguration -> f RequestPaymentConfiguration
requestPaymentConfiguration_payer = (RequestPaymentConfiguration -> Payer)
-> (RequestPaymentConfiguration
    -> Payer -> RequestPaymentConfiguration)
-> Lens
     RequestPaymentConfiguration RequestPaymentConfiguration Payer Payer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestPaymentConfiguration' {Payer
payer :: Payer
$sel:payer:RequestPaymentConfiguration' :: RequestPaymentConfiguration -> Payer
payer} -> Payer
payer) (\s :: RequestPaymentConfiguration
s@RequestPaymentConfiguration' {} Payer
a -> RequestPaymentConfiguration
s {$sel:payer:RequestPaymentConfiguration' :: Payer
payer = Payer
a} :: RequestPaymentConfiguration)

instance Prelude.Hashable RequestPaymentConfiguration

instance Prelude.NFData RequestPaymentConfiguration

instance Core.ToXML RequestPaymentConfiguration where
  toXML :: RequestPaymentConfiguration -> XML
toXML RequestPaymentConfiguration' {Payer
payer :: Payer
$sel:payer:RequestPaymentConfiguration' :: RequestPaymentConfiguration -> Payer
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Payer" Name -> Payer -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Payer
payer]