{-# 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.Scheduler.Types.ScheduleSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Scheduler.Types.ScheduleSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Scheduler.Types.ScheduleState
import Amazonka.Scheduler.Types.TargetSummary

-- | The details of a schedule.
--
-- /See:/ 'newScheduleSummary' smart constructor.
data ScheduleSummary = ScheduleSummary'
  { -- | The Amazon Resource Name (ARN) of the schedule.
    ScheduleSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time at which the schedule was created.
    ScheduleSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Data.POSIX,
    -- | The name of the schedule group associated with this schedule.
    ScheduleSummary -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text,
    -- | The time at which the schedule was last modified.
    ScheduleSummary -> Maybe POSIX
lastModificationDate :: Prelude.Maybe Data.POSIX,
    -- | The name of the schedule.
    ScheduleSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the schedule is enabled or disabled.
    ScheduleSummary -> Maybe ScheduleState
state :: Prelude.Maybe ScheduleState,
    -- | The schedule\'s target details.
    ScheduleSummary -> Maybe TargetSummary
target :: Prelude.Maybe TargetSummary
  }
  deriving (ScheduleSummary -> ScheduleSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleSummary -> ScheduleSummary -> Bool
$c/= :: ScheduleSummary -> ScheduleSummary -> Bool
== :: ScheduleSummary -> ScheduleSummary -> Bool
$c== :: ScheduleSummary -> ScheduleSummary -> Bool
Prelude.Eq, ReadPrec [ScheduleSummary]
ReadPrec ScheduleSummary
Int -> ReadS ScheduleSummary
ReadS [ScheduleSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleSummary]
$creadListPrec :: ReadPrec [ScheduleSummary]
readPrec :: ReadPrec ScheduleSummary
$creadPrec :: ReadPrec ScheduleSummary
readList :: ReadS [ScheduleSummary]
$creadList :: ReadS [ScheduleSummary]
readsPrec :: Int -> ReadS ScheduleSummary
$creadsPrec :: Int -> ReadS ScheduleSummary
Prelude.Read, Int -> ScheduleSummary -> ShowS
[ScheduleSummary] -> ShowS
ScheduleSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleSummary] -> ShowS
$cshowList :: [ScheduleSummary] -> ShowS
show :: ScheduleSummary -> String
$cshow :: ScheduleSummary -> String
showsPrec :: Int -> ScheduleSummary -> ShowS
$cshowsPrec :: Int -> ScheduleSummary -> ShowS
Prelude.Show, forall x. Rep ScheduleSummary x -> ScheduleSummary
forall x. ScheduleSummary -> Rep ScheduleSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduleSummary x -> ScheduleSummary
$cfrom :: forall x. ScheduleSummary -> Rep ScheduleSummary x
Prelude.Generic)

-- |
-- Create a value of 'ScheduleSummary' 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:
--
-- 'arn', 'scheduleSummary_arn' - The Amazon Resource Name (ARN) of the schedule.
--
-- 'creationDate', 'scheduleSummary_creationDate' - The time at which the schedule was created.
--
-- 'groupName', 'scheduleSummary_groupName' - The name of the schedule group associated with this schedule.
--
-- 'lastModificationDate', 'scheduleSummary_lastModificationDate' - The time at which the schedule was last modified.
--
-- 'name', 'scheduleSummary_name' - The name of the schedule.
--
-- 'state', 'scheduleSummary_state' - Specifies whether the schedule is enabled or disabled.
--
-- 'target', 'scheduleSummary_target' - The schedule\'s target details.
newScheduleSummary ::
  ScheduleSummary
newScheduleSummary :: ScheduleSummary
newScheduleSummary =
  ScheduleSummary'
    { $sel:arn:ScheduleSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:ScheduleSummary' :: Maybe POSIX
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:ScheduleSummary' :: Maybe Text
groupName = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModificationDate:ScheduleSummary' :: Maybe POSIX
lastModificationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ScheduleSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:state:ScheduleSummary' :: Maybe ScheduleState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:target:ScheduleSummary' :: Maybe TargetSummary
target = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the schedule.
scheduleSummary_arn :: Lens.Lens' ScheduleSummary (Prelude.Maybe Prelude.Text)
scheduleSummary_arn :: Lens' ScheduleSummary (Maybe Text)
scheduleSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:ScheduleSummary' :: ScheduleSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ScheduleSummary
s@ScheduleSummary' {} Maybe Text
a -> ScheduleSummary
s {$sel:arn:ScheduleSummary' :: Maybe Text
arn = Maybe Text
a} :: ScheduleSummary)

-- | The time at which the schedule was created.
scheduleSummary_creationDate :: Lens.Lens' ScheduleSummary (Prelude.Maybe Prelude.UTCTime)
scheduleSummary_creationDate :: Lens' ScheduleSummary (Maybe UTCTime)
scheduleSummary_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:ScheduleSummary' :: ScheduleSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: ScheduleSummary
s@ScheduleSummary' {} Maybe POSIX
a -> ScheduleSummary
s {$sel:creationDate:ScheduleSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: ScheduleSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the schedule group associated with this schedule.
scheduleSummary_groupName :: Lens.Lens' ScheduleSummary (Prelude.Maybe Prelude.Text)
scheduleSummary_groupName :: Lens' ScheduleSummary (Maybe Text)
scheduleSummary_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleSummary' {Maybe Text
groupName :: Maybe Text
$sel:groupName:ScheduleSummary' :: ScheduleSummary -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: ScheduleSummary
s@ScheduleSummary' {} Maybe Text
a -> ScheduleSummary
s {$sel:groupName:ScheduleSummary' :: Maybe Text
groupName = Maybe Text
a} :: ScheduleSummary)

-- | The time at which the schedule was last modified.
scheduleSummary_lastModificationDate :: Lens.Lens' ScheduleSummary (Prelude.Maybe Prelude.UTCTime)
scheduleSummary_lastModificationDate :: Lens' ScheduleSummary (Maybe UTCTime)
scheduleSummary_lastModificationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleSummary' {Maybe POSIX
lastModificationDate :: Maybe POSIX
$sel:lastModificationDate:ScheduleSummary' :: ScheduleSummary -> Maybe POSIX
lastModificationDate} -> Maybe POSIX
lastModificationDate) (\s :: ScheduleSummary
s@ScheduleSummary' {} Maybe POSIX
a -> ScheduleSummary
s {$sel:lastModificationDate:ScheduleSummary' :: Maybe POSIX
lastModificationDate = Maybe POSIX
a} :: ScheduleSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the schedule.
scheduleSummary_name :: Lens.Lens' ScheduleSummary (Prelude.Maybe Prelude.Text)
scheduleSummary_name :: Lens' ScheduleSummary (Maybe Text)
scheduleSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleSummary' {Maybe Text
name :: Maybe Text
$sel:name:ScheduleSummary' :: ScheduleSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: ScheduleSummary
s@ScheduleSummary' {} Maybe Text
a -> ScheduleSummary
s {$sel:name:ScheduleSummary' :: Maybe Text
name = Maybe Text
a} :: ScheduleSummary)

-- | Specifies whether the schedule is enabled or disabled.
scheduleSummary_state :: Lens.Lens' ScheduleSummary (Prelude.Maybe ScheduleState)
scheduleSummary_state :: Lens' ScheduleSummary (Maybe ScheduleState)
scheduleSummary_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleSummary' {Maybe ScheduleState
state :: Maybe ScheduleState
$sel:state:ScheduleSummary' :: ScheduleSummary -> Maybe ScheduleState
state} -> Maybe ScheduleState
state) (\s :: ScheduleSummary
s@ScheduleSummary' {} Maybe ScheduleState
a -> ScheduleSummary
s {$sel:state:ScheduleSummary' :: Maybe ScheduleState
state = Maybe ScheduleState
a} :: ScheduleSummary)

-- | The schedule\'s target details.
scheduleSummary_target :: Lens.Lens' ScheduleSummary (Prelude.Maybe TargetSummary)
scheduleSummary_target :: Lens' ScheduleSummary (Maybe TargetSummary)
scheduleSummary_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleSummary' {Maybe TargetSummary
target :: Maybe TargetSummary
$sel:target:ScheduleSummary' :: ScheduleSummary -> Maybe TargetSummary
target} -> Maybe TargetSummary
target) (\s :: ScheduleSummary
s@ScheduleSummary' {} Maybe TargetSummary
a -> ScheduleSummary
s {$sel:target:ScheduleSummary' :: Maybe TargetSummary
target = Maybe TargetSummary
a} :: ScheduleSummary)

instance Data.FromJSON ScheduleSummary where
  parseJSON :: Value -> Parser ScheduleSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScheduleSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe ScheduleState
-> Maybe TargetSummary
-> ScheduleSummary
ScheduleSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreationDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GroupName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastModificationDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"State")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Target")
      )

instance Prelude.Hashable ScheduleSummary where
  hashWithSalt :: Int -> ScheduleSummary -> Int
hashWithSalt Int
_salt ScheduleSummary' {Maybe Text
Maybe POSIX
Maybe ScheduleState
Maybe TargetSummary
target :: Maybe TargetSummary
state :: Maybe ScheduleState
name :: Maybe Text
lastModificationDate :: Maybe POSIX
groupName :: Maybe Text
creationDate :: Maybe POSIX
arn :: Maybe Text
$sel:target:ScheduleSummary' :: ScheduleSummary -> Maybe TargetSummary
$sel:state:ScheduleSummary' :: ScheduleSummary -> Maybe ScheduleState
$sel:name:ScheduleSummary' :: ScheduleSummary -> Maybe Text
$sel:lastModificationDate:ScheduleSummary' :: ScheduleSummary -> Maybe POSIX
$sel:groupName:ScheduleSummary' :: ScheduleSummary -> Maybe Text
$sel:creationDate:ScheduleSummary' :: ScheduleSummary -> Maybe POSIX
$sel:arn:ScheduleSummary' :: ScheduleSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModificationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScheduleState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetSummary
target

instance Prelude.NFData ScheduleSummary where
  rnf :: ScheduleSummary -> ()
rnf ScheduleSummary' {Maybe Text
Maybe POSIX
Maybe ScheduleState
Maybe TargetSummary
target :: Maybe TargetSummary
state :: Maybe ScheduleState
name :: Maybe Text
lastModificationDate :: Maybe POSIX
groupName :: Maybe Text
creationDate :: Maybe POSIX
arn :: Maybe Text
$sel:target:ScheduleSummary' :: ScheduleSummary -> Maybe TargetSummary
$sel:state:ScheduleSummary' :: ScheduleSummary -> Maybe ScheduleState
$sel:name:ScheduleSummary' :: ScheduleSummary -> Maybe Text
$sel:lastModificationDate:ScheduleSummary' :: ScheduleSummary -> Maybe POSIX
$sel:groupName:ScheduleSummary' :: ScheduleSummary -> Maybe Text
$sel:creationDate:ScheduleSummary' :: ScheduleSummary -> Maybe POSIX
$sel:arn:ScheduleSummary' :: ScheduleSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModificationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScheduleState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetSummary
target