{-# 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.InventorySchedule
-- 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.InventorySchedule 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.InventoryFrequency

-- | Specifies the schedule for generating inventory results.
--
-- /See:/ 'newInventorySchedule' smart constructor.
data InventorySchedule = InventorySchedule'
  { -- | Specifies how frequently inventory results are produced.
    InventorySchedule -> InventoryFrequency
frequency :: InventoryFrequency
  }
  deriving (InventorySchedule -> InventorySchedule -> Bool
(InventorySchedule -> InventorySchedule -> Bool)
-> (InventorySchedule -> InventorySchedule -> Bool)
-> Eq InventorySchedule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InventorySchedule -> InventorySchedule -> Bool
$c/= :: InventorySchedule -> InventorySchedule -> Bool
== :: InventorySchedule -> InventorySchedule -> Bool
$c== :: InventorySchedule -> InventorySchedule -> Bool
Prelude.Eq, ReadPrec [InventorySchedule]
ReadPrec InventorySchedule
Int -> ReadS InventorySchedule
ReadS [InventorySchedule]
(Int -> ReadS InventorySchedule)
-> ReadS [InventorySchedule]
-> ReadPrec InventorySchedule
-> ReadPrec [InventorySchedule]
-> Read InventorySchedule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InventorySchedule]
$creadListPrec :: ReadPrec [InventorySchedule]
readPrec :: ReadPrec InventorySchedule
$creadPrec :: ReadPrec InventorySchedule
readList :: ReadS [InventorySchedule]
$creadList :: ReadS [InventorySchedule]
readsPrec :: Int -> ReadS InventorySchedule
$creadsPrec :: Int -> ReadS InventorySchedule
Prelude.Read, Int -> InventorySchedule -> ShowS
[InventorySchedule] -> ShowS
InventorySchedule -> String
(Int -> InventorySchedule -> ShowS)
-> (InventorySchedule -> String)
-> ([InventorySchedule] -> ShowS)
-> Show InventorySchedule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InventorySchedule] -> ShowS
$cshowList :: [InventorySchedule] -> ShowS
show :: InventorySchedule -> String
$cshow :: InventorySchedule -> String
showsPrec :: Int -> InventorySchedule -> ShowS
$cshowsPrec :: Int -> InventorySchedule -> ShowS
Prelude.Show, (forall x. InventorySchedule -> Rep InventorySchedule x)
-> (forall x. Rep InventorySchedule x -> InventorySchedule)
-> Generic InventorySchedule
forall x. Rep InventorySchedule x -> InventorySchedule
forall x. InventorySchedule -> Rep InventorySchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InventorySchedule x -> InventorySchedule
$cfrom :: forall x. InventorySchedule -> Rep InventorySchedule x
Prelude.Generic)

-- |
-- Create a value of 'InventorySchedule' 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:
--
-- 'frequency', 'inventorySchedule_frequency' - Specifies how frequently inventory results are produced.
newInventorySchedule ::
  -- | 'frequency'
  InventoryFrequency ->
  InventorySchedule
newInventorySchedule :: InventoryFrequency -> InventorySchedule
newInventorySchedule InventoryFrequency
pFrequency_ =
  InventorySchedule' :: InventoryFrequency -> InventorySchedule
InventorySchedule' {$sel:frequency:InventorySchedule' :: InventoryFrequency
frequency = InventoryFrequency
pFrequency_}

-- | Specifies how frequently inventory results are produced.
inventorySchedule_frequency :: Lens.Lens' InventorySchedule InventoryFrequency
inventorySchedule_frequency :: (InventoryFrequency -> f InventoryFrequency)
-> InventorySchedule -> f InventorySchedule
inventorySchedule_frequency = (InventorySchedule -> InventoryFrequency)
-> (InventorySchedule -> InventoryFrequency -> InventorySchedule)
-> Lens
     InventorySchedule
     InventorySchedule
     InventoryFrequency
     InventoryFrequency
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventorySchedule' {InventoryFrequency
frequency :: InventoryFrequency
$sel:frequency:InventorySchedule' :: InventorySchedule -> InventoryFrequency
frequency} -> InventoryFrequency
frequency) (\s :: InventorySchedule
s@InventorySchedule' {} InventoryFrequency
a -> InventorySchedule
s {$sel:frequency:InventorySchedule' :: InventoryFrequency
frequency = InventoryFrequency
a} :: InventorySchedule)

instance Core.FromXML InventorySchedule where
  parseXML :: [Node] -> Either String InventorySchedule
parseXML [Node]
x =
    InventoryFrequency -> InventorySchedule
InventorySchedule'
      (InventoryFrequency -> InventorySchedule)
-> Either String InventoryFrequency
-> Either String InventorySchedule
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String InventoryFrequency
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Frequency")

instance Prelude.Hashable InventorySchedule

instance Prelude.NFData InventorySchedule

instance Core.ToXML InventorySchedule where
  toXML :: InventorySchedule -> XML
toXML InventorySchedule' {InventoryFrequency
frequency :: InventoryFrequency
$sel:frequency:InventorySchedule' :: InventorySchedule -> InventoryFrequency
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Frequency" Name -> InventoryFrequency -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= InventoryFrequency
frequency]