{-# 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.IoT.Types.ScheduledAuditMetadata
-- 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.IoT.Types.ScheduledAuditMetadata where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.AuditFrequency
import Amazonka.IoT.Types.DayOfWeek
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the scheduled audit.
--
-- /See:/ 'newScheduledAuditMetadata' smart constructor.
data ScheduledAuditMetadata = ScheduledAuditMetadata'
  { -- | How often the scheduled audit occurs.
    ScheduledAuditMetadata -> Maybe AuditFrequency
frequency :: Prelude.Maybe AuditFrequency,
    -- | The name of the scheduled audit.
    ScheduledAuditMetadata -> Maybe Text
scheduledAuditName :: Prelude.Maybe Prelude.Text,
    -- | The day of the month on which the scheduled audit is run (if the
    -- @frequency@ is \"MONTHLY\"). If days 29-31 are specified, and the month
    -- does not have that many days, the audit takes place on the \"LAST\" day
    -- of the month.
    ScheduledAuditMetadata -> Maybe Text
dayOfMonth :: Prelude.Maybe Prelude.Text,
    -- | The day of the week on which the scheduled audit is run (if the
    -- @frequency@ is \"WEEKLY\" or \"BIWEEKLY\").
    ScheduledAuditMetadata -> Maybe DayOfWeek
dayOfWeek :: Prelude.Maybe DayOfWeek,
    -- | The ARN of the scheduled audit.
    ScheduledAuditMetadata -> Maybe Text
scheduledAuditArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ScheduledAuditMetadata -> ScheduledAuditMetadata -> Bool
(ScheduledAuditMetadata -> ScheduledAuditMetadata -> Bool)
-> (ScheduledAuditMetadata -> ScheduledAuditMetadata -> Bool)
-> Eq ScheduledAuditMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduledAuditMetadata -> ScheduledAuditMetadata -> Bool
$c/= :: ScheduledAuditMetadata -> ScheduledAuditMetadata -> Bool
== :: ScheduledAuditMetadata -> ScheduledAuditMetadata -> Bool
$c== :: ScheduledAuditMetadata -> ScheduledAuditMetadata -> Bool
Prelude.Eq, ReadPrec [ScheduledAuditMetadata]
ReadPrec ScheduledAuditMetadata
Int -> ReadS ScheduledAuditMetadata
ReadS [ScheduledAuditMetadata]
(Int -> ReadS ScheduledAuditMetadata)
-> ReadS [ScheduledAuditMetadata]
-> ReadPrec ScheduledAuditMetadata
-> ReadPrec [ScheduledAuditMetadata]
-> Read ScheduledAuditMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduledAuditMetadata]
$creadListPrec :: ReadPrec [ScheduledAuditMetadata]
readPrec :: ReadPrec ScheduledAuditMetadata
$creadPrec :: ReadPrec ScheduledAuditMetadata
readList :: ReadS [ScheduledAuditMetadata]
$creadList :: ReadS [ScheduledAuditMetadata]
readsPrec :: Int -> ReadS ScheduledAuditMetadata
$creadsPrec :: Int -> ReadS ScheduledAuditMetadata
Prelude.Read, Int -> ScheduledAuditMetadata -> ShowS
[ScheduledAuditMetadata] -> ShowS
ScheduledAuditMetadata -> String
(Int -> ScheduledAuditMetadata -> ShowS)
-> (ScheduledAuditMetadata -> String)
-> ([ScheduledAuditMetadata] -> ShowS)
-> Show ScheduledAuditMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduledAuditMetadata] -> ShowS
$cshowList :: [ScheduledAuditMetadata] -> ShowS
show :: ScheduledAuditMetadata -> String
$cshow :: ScheduledAuditMetadata -> String
showsPrec :: Int -> ScheduledAuditMetadata -> ShowS
$cshowsPrec :: Int -> ScheduledAuditMetadata -> ShowS
Prelude.Show, (forall x. ScheduledAuditMetadata -> Rep ScheduledAuditMetadata x)
-> (forall x.
    Rep ScheduledAuditMetadata x -> ScheduledAuditMetadata)
-> Generic ScheduledAuditMetadata
forall x. Rep ScheduledAuditMetadata x -> ScheduledAuditMetadata
forall x. ScheduledAuditMetadata -> Rep ScheduledAuditMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduledAuditMetadata x -> ScheduledAuditMetadata
$cfrom :: forall x. ScheduledAuditMetadata -> Rep ScheduledAuditMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ScheduledAuditMetadata' 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', 'scheduledAuditMetadata_frequency' - How often the scheduled audit occurs.
--
-- 'scheduledAuditName', 'scheduledAuditMetadata_scheduledAuditName' - The name of the scheduled audit.
--
-- 'dayOfMonth', 'scheduledAuditMetadata_dayOfMonth' - The day of the month on which the scheduled audit is run (if the
-- @frequency@ is \"MONTHLY\"). If days 29-31 are specified, and the month
-- does not have that many days, the audit takes place on the \"LAST\" day
-- of the month.
--
-- 'dayOfWeek', 'scheduledAuditMetadata_dayOfWeek' - The day of the week on which the scheduled audit is run (if the
-- @frequency@ is \"WEEKLY\" or \"BIWEEKLY\").
--
-- 'scheduledAuditArn', 'scheduledAuditMetadata_scheduledAuditArn' - The ARN of the scheduled audit.
newScheduledAuditMetadata ::
  ScheduledAuditMetadata
newScheduledAuditMetadata :: ScheduledAuditMetadata
newScheduledAuditMetadata =
  ScheduledAuditMetadata' :: Maybe AuditFrequency
-> Maybe Text
-> Maybe Text
-> Maybe DayOfWeek
-> Maybe Text
-> ScheduledAuditMetadata
ScheduledAuditMetadata'
    { $sel:frequency:ScheduledAuditMetadata' :: Maybe AuditFrequency
frequency =
        Maybe AuditFrequency
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledAuditName:ScheduledAuditMetadata' :: Maybe Text
scheduledAuditName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dayOfMonth:ScheduledAuditMetadata' :: Maybe Text
dayOfMonth = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dayOfWeek:ScheduledAuditMetadata' :: Maybe DayOfWeek
dayOfWeek = Maybe DayOfWeek
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledAuditArn:ScheduledAuditMetadata' :: Maybe Text
scheduledAuditArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | How often the scheduled audit occurs.
scheduledAuditMetadata_frequency :: Lens.Lens' ScheduledAuditMetadata (Prelude.Maybe AuditFrequency)
scheduledAuditMetadata_frequency :: (Maybe AuditFrequency -> f (Maybe AuditFrequency))
-> ScheduledAuditMetadata -> f ScheduledAuditMetadata
scheduledAuditMetadata_frequency = (ScheduledAuditMetadata -> Maybe AuditFrequency)
-> (ScheduledAuditMetadata
    -> Maybe AuditFrequency -> ScheduledAuditMetadata)
-> Lens
     ScheduledAuditMetadata
     ScheduledAuditMetadata
     (Maybe AuditFrequency)
     (Maybe AuditFrequency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAuditMetadata' {Maybe AuditFrequency
frequency :: Maybe AuditFrequency
$sel:frequency:ScheduledAuditMetadata' :: ScheduledAuditMetadata -> Maybe AuditFrequency
frequency} -> Maybe AuditFrequency
frequency) (\s :: ScheduledAuditMetadata
s@ScheduledAuditMetadata' {} Maybe AuditFrequency
a -> ScheduledAuditMetadata
s {$sel:frequency:ScheduledAuditMetadata' :: Maybe AuditFrequency
frequency = Maybe AuditFrequency
a} :: ScheduledAuditMetadata)

-- | The name of the scheduled audit.
scheduledAuditMetadata_scheduledAuditName :: Lens.Lens' ScheduledAuditMetadata (Prelude.Maybe Prelude.Text)
scheduledAuditMetadata_scheduledAuditName :: (Maybe Text -> f (Maybe Text))
-> ScheduledAuditMetadata -> f ScheduledAuditMetadata
scheduledAuditMetadata_scheduledAuditName = (ScheduledAuditMetadata -> Maybe Text)
-> (ScheduledAuditMetadata -> Maybe Text -> ScheduledAuditMetadata)
-> Lens
     ScheduledAuditMetadata
     ScheduledAuditMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAuditMetadata' {Maybe Text
scheduledAuditName :: Maybe Text
$sel:scheduledAuditName:ScheduledAuditMetadata' :: ScheduledAuditMetadata -> Maybe Text
scheduledAuditName} -> Maybe Text
scheduledAuditName) (\s :: ScheduledAuditMetadata
s@ScheduledAuditMetadata' {} Maybe Text
a -> ScheduledAuditMetadata
s {$sel:scheduledAuditName:ScheduledAuditMetadata' :: Maybe Text
scheduledAuditName = Maybe Text
a} :: ScheduledAuditMetadata)

-- | The day of the month on which the scheduled audit is run (if the
-- @frequency@ is \"MONTHLY\"). If days 29-31 are specified, and the month
-- does not have that many days, the audit takes place on the \"LAST\" day
-- of the month.
scheduledAuditMetadata_dayOfMonth :: Lens.Lens' ScheduledAuditMetadata (Prelude.Maybe Prelude.Text)
scheduledAuditMetadata_dayOfMonth :: (Maybe Text -> f (Maybe Text))
-> ScheduledAuditMetadata -> f ScheduledAuditMetadata
scheduledAuditMetadata_dayOfMonth = (ScheduledAuditMetadata -> Maybe Text)
-> (ScheduledAuditMetadata -> Maybe Text -> ScheduledAuditMetadata)
-> Lens
     ScheduledAuditMetadata
     ScheduledAuditMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAuditMetadata' {Maybe Text
dayOfMonth :: Maybe Text
$sel:dayOfMonth:ScheduledAuditMetadata' :: ScheduledAuditMetadata -> Maybe Text
dayOfMonth} -> Maybe Text
dayOfMonth) (\s :: ScheduledAuditMetadata
s@ScheduledAuditMetadata' {} Maybe Text
a -> ScheduledAuditMetadata
s {$sel:dayOfMonth:ScheduledAuditMetadata' :: Maybe Text
dayOfMonth = Maybe Text
a} :: ScheduledAuditMetadata)

-- | The day of the week on which the scheduled audit is run (if the
-- @frequency@ is \"WEEKLY\" or \"BIWEEKLY\").
scheduledAuditMetadata_dayOfWeek :: Lens.Lens' ScheduledAuditMetadata (Prelude.Maybe DayOfWeek)
scheduledAuditMetadata_dayOfWeek :: (Maybe DayOfWeek -> f (Maybe DayOfWeek))
-> ScheduledAuditMetadata -> f ScheduledAuditMetadata
scheduledAuditMetadata_dayOfWeek = (ScheduledAuditMetadata -> Maybe DayOfWeek)
-> (ScheduledAuditMetadata
    -> Maybe DayOfWeek -> ScheduledAuditMetadata)
-> Lens
     ScheduledAuditMetadata
     ScheduledAuditMetadata
     (Maybe DayOfWeek)
     (Maybe DayOfWeek)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAuditMetadata' {Maybe DayOfWeek
dayOfWeek :: Maybe DayOfWeek
$sel:dayOfWeek:ScheduledAuditMetadata' :: ScheduledAuditMetadata -> Maybe DayOfWeek
dayOfWeek} -> Maybe DayOfWeek
dayOfWeek) (\s :: ScheduledAuditMetadata
s@ScheduledAuditMetadata' {} Maybe DayOfWeek
a -> ScheduledAuditMetadata
s {$sel:dayOfWeek:ScheduledAuditMetadata' :: Maybe DayOfWeek
dayOfWeek = Maybe DayOfWeek
a} :: ScheduledAuditMetadata)

-- | The ARN of the scheduled audit.
scheduledAuditMetadata_scheduledAuditArn :: Lens.Lens' ScheduledAuditMetadata (Prelude.Maybe Prelude.Text)
scheduledAuditMetadata_scheduledAuditArn :: (Maybe Text -> f (Maybe Text))
-> ScheduledAuditMetadata -> f ScheduledAuditMetadata
scheduledAuditMetadata_scheduledAuditArn = (ScheduledAuditMetadata -> Maybe Text)
-> (ScheduledAuditMetadata -> Maybe Text -> ScheduledAuditMetadata)
-> Lens
     ScheduledAuditMetadata
     ScheduledAuditMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledAuditMetadata' {Maybe Text
scheduledAuditArn :: Maybe Text
$sel:scheduledAuditArn:ScheduledAuditMetadata' :: ScheduledAuditMetadata -> Maybe Text
scheduledAuditArn} -> Maybe Text
scheduledAuditArn) (\s :: ScheduledAuditMetadata
s@ScheduledAuditMetadata' {} Maybe Text
a -> ScheduledAuditMetadata
s {$sel:scheduledAuditArn:ScheduledAuditMetadata' :: Maybe Text
scheduledAuditArn = Maybe Text
a} :: ScheduledAuditMetadata)

instance Core.FromJSON ScheduledAuditMetadata where
  parseJSON :: Value -> Parser ScheduledAuditMetadata
parseJSON =
    String
-> (Object -> Parser ScheduledAuditMetadata)
-> Value
-> Parser ScheduledAuditMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ScheduledAuditMetadata"
      ( \Object
x ->
          Maybe AuditFrequency
-> Maybe Text
-> Maybe Text
-> Maybe DayOfWeek
-> Maybe Text
-> ScheduledAuditMetadata
ScheduledAuditMetadata'
            (Maybe AuditFrequency
 -> Maybe Text
 -> Maybe Text
 -> Maybe DayOfWeek
 -> Maybe Text
 -> ScheduledAuditMetadata)
-> Parser (Maybe AuditFrequency)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe DayOfWeek
      -> Maybe Text
      -> ScheduledAuditMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AuditFrequency)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"frequency")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe DayOfWeek
   -> Maybe Text
   -> ScheduledAuditMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe DayOfWeek -> Maybe Text -> ScheduledAuditMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"scheduledAuditName")
            Parser
  (Maybe Text
   -> Maybe DayOfWeek -> Maybe Text -> ScheduledAuditMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe DayOfWeek -> Maybe Text -> ScheduledAuditMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dayOfMonth")
            Parser (Maybe DayOfWeek -> Maybe Text -> ScheduledAuditMetadata)
-> Parser (Maybe DayOfWeek)
-> Parser (Maybe Text -> ScheduledAuditMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DayOfWeek)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dayOfWeek")
            Parser (Maybe Text -> ScheduledAuditMetadata)
-> Parser (Maybe Text) -> Parser ScheduledAuditMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"scheduledAuditArn")
      )

instance Prelude.Hashable ScheduledAuditMetadata

instance Prelude.NFData ScheduledAuditMetadata