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

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

-- | Container for specifying if periodic @QueryProgress@ messages should be
-- sent.
--
-- /See:/ 'newRequestProgress' smart constructor.
data RequestProgress = RequestProgress'
  { -- | Specifies whether periodic QueryProgress frames should be sent. Valid
    -- values: TRUE, FALSE. Default value: FALSE.
    RequestProgress -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (RequestProgress -> RequestProgress -> Bool
(RequestProgress -> RequestProgress -> Bool)
-> (RequestProgress -> RequestProgress -> Bool)
-> Eq RequestProgress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestProgress -> RequestProgress -> Bool
$c/= :: RequestProgress -> RequestProgress -> Bool
== :: RequestProgress -> RequestProgress -> Bool
$c== :: RequestProgress -> RequestProgress -> Bool
Prelude.Eq, ReadPrec [RequestProgress]
ReadPrec RequestProgress
Int -> ReadS RequestProgress
ReadS [RequestProgress]
(Int -> ReadS RequestProgress)
-> ReadS [RequestProgress]
-> ReadPrec RequestProgress
-> ReadPrec [RequestProgress]
-> Read RequestProgress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequestProgress]
$creadListPrec :: ReadPrec [RequestProgress]
readPrec :: ReadPrec RequestProgress
$creadPrec :: ReadPrec RequestProgress
readList :: ReadS [RequestProgress]
$creadList :: ReadS [RequestProgress]
readsPrec :: Int -> ReadS RequestProgress
$creadsPrec :: Int -> ReadS RequestProgress
Prelude.Read, Int -> RequestProgress -> ShowS
[RequestProgress] -> ShowS
RequestProgress -> String
(Int -> RequestProgress -> ShowS)
-> (RequestProgress -> String)
-> ([RequestProgress] -> ShowS)
-> Show RequestProgress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestProgress] -> ShowS
$cshowList :: [RequestProgress] -> ShowS
show :: RequestProgress -> String
$cshow :: RequestProgress -> String
showsPrec :: Int -> RequestProgress -> ShowS
$cshowsPrec :: Int -> RequestProgress -> ShowS
Prelude.Show, (forall x. RequestProgress -> Rep RequestProgress x)
-> (forall x. Rep RequestProgress x -> RequestProgress)
-> Generic RequestProgress
forall x. Rep RequestProgress x -> RequestProgress
forall x. RequestProgress -> Rep RequestProgress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RequestProgress x -> RequestProgress
$cfrom :: forall x. RequestProgress -> Rep RequestProgress x
Prelude.Generic)

-- |
-- Create a value of 'RequestProgress' 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:
--
-- 'enabled', 'requestProgress_enabled' - Specifies whether periodic QueryProgress frames should be sent. Valid
-- values: TRUE, FALSE. Default value: FALSE.
newRequestProgress ::
  RequestProgress
newRequestProgress :: RequestProgress
newRequestProgress =
  RequestProgress' :: Maybe Bool -> RequestProgress
RequestProgress' {$sel:enabled:RequestProgress' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing}

-- | Specifies whether periodic QueryProgress frames should be sent. Valid
-- values: TRUE, FALSE. Default value: FALSE.
requestProgress_enabled :: Lens.Lens' RequestProgress (Prelude.Maybe Prelude.Bool)
requestProgress_enabled :: (Maybe Bool -> f (Maybe Bool))
-> RequestProgress -> f RequestProgress
requestProgress_enabled = (RequestProgress -> Maybe Bool)
-> (RequestProgress -> Maybe Bool -> RequestProgress)
-> Lens RequestProgress RequestProgress (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestProgress' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:RequestProgress' :: RequestProgress -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: RequestProgress
s@RequestProgress' {} Maybe Bool
a -> RequestProgress
s {$sel:enabled:RequestProgress' :: Maybe Bool
enabled = Maybe Bool
a} :: RequestProgress)

instance Prelude.Hashable RequestProgress

instance Prelude.NFData RequestProgress

instance Core.ToXML RequestProgress where
  toXML :: RequestProgress -> XML
toXML RequestProgress' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:RequestProgress' :: RequestProgress -> Maybe Bool
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Enabled" Name -> Maybe Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Bool
enabled]