{-# 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.TimeStreamQuery.Types.ScheduledQueryDescription
-- 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.TimeStreamQuery.Types.ScheduledQueryDescription 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.TimeStreamQuery.Types.ErrorReportConfiguration
import Amazonka.TimeStreamQuery.Types.NotificationConfiguration
import Amazonka.TimeStreamQuery.Types.ScheduleConfiguration
import Amazonka.TimeStreamQuery.Types.ScheduledQueryRunSummary
import Amazonka.TimeStreamQuery.Types.ScheduledQueryState
import Amazonka.TimeStreamQuery.Types.TargetConfiguration

-- | Structure that describes scheduled query.
--
-- /See:/ 'newScheduledQueryDescription' smart constructor.
data ScheduledQueryDescription = ScheduledQueryDescription'
  { -- | Creation time of the scheduled query.
    ScheduledQueryDescription -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | Error-reporting configuration for the scheduled query.
    ScheduledQueryDescription -> Maybe ErrorReportConfiguration
errorReportConfiguration :: Prelude.Maybe ErrorReportConfiguration,
    -- | A customer provided KMS key used to encrypt the scheduled query
    -- resource.
    ScheduledQueryDescription -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Runtime summary for the last scheduled query run.
    ScheduledQueryDescription -> Maybe ScheduledQueryRunSummary
lastRunSummary :: Prelude.Maybe ScheduledQueryRunSummary,
    -- | The next time the scheduled query is scheduled to run.
    ScheduledQueryDescription -> Maybe POSIX
nextInvocationTime :: Prelude.Maybe Data.POSIX,
    -- | Last time the query was run.
    ScheduledQueryDescription -> Maybe POSIX
previousInvocationTime :: Prelude.Maybe Data.POSIX,
    -- | Runtime summary for the last five failed scheduled query runs.
    ScheduledQueryDescription -> Maybe [ScheduledQueryRunSummary]
recentlyFailedRuns :: Prelude.Maybe [ScheduledQueryRunSummary],
    -- | IAM role that Timestream uses to run the schedule query.
    ScheduledQueryDescription -> Maybe Text
scheduledQueryExecutionRoleArn :: Prelude.Maybe Prelude.Text,
    -- | Scheduled query target store configuration.
    ScheduledQueryDescription -> Maybe TargetConfiguration
targetConfiguration :: Prelude.Maybe TargetConfiguration,
    -- | Scheduled query ARN.
    ScheduledQueryDescription -> Text
arn :: Prelude.Text,
    -- | Name of the scheduled query.
    ScheduledQueryDescription -> Text
name :: Prelude.Text,
    -- | The query to be run.
    ScheduledQueryDescription -> Sensitive Text
queryString :: Data.Sensitive Prelude.Text,
    -- | State of the scheduled query.
    ScheduledQueryDescription -> ScheduledQueryState
state :: ScheduledQueryState,
    -- | Schedule configuration.
    ScheduledQueryDescription -> ScheduleConfiguration
scheduleConfiguration :: ScheduleConfiguration,
    -- | Notification configuration.
    ScheduledQueryDescription -> NotificationConfiguration
notificationConfiguration :: NotificationConfiguration
  }
  deriving (ScheduledQueryDescription -> ScheduledQueryDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduledQueryDescription -> ScheduledQueryDescription -> Bool
$c/= :: ScheduledQueryDescription -> ScheduledQueryDescription -> Bool
== :: ScheduledQueryDescription -> ScheduledQueryDescription -> Bool
$c== :: ScheduledQueryDescription -> ScheduledQueryDescription -> Bool
Prelude.Eq, Int -> ScheduledQueryDescription -> ShowS
[ScheduledQueryDescription] -> ShowS
ScheduledQueryDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduledQueryDescription] -> ShowS
$cshowList :: [ScheduledQueryDescription] -> ShowS
show :: ScheduledQueryDescription -> String
$cshow :: ScheduledQueryDescription -> String
showsPrec :: Int -> ScheduledQueryDescription -> ShowS
$cshowsPrec :: Int -> ScheduledQueryDescription -> ShowS
Prelude.Show, forall x.
Rep ScheduledQueryDescription x -> ScheduledQueryDescription
forall x.
ScheduledQueryDescription -> Rep ScheduledQueryDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScheduledQueryDescription x -> ScheduledQueryDescription
$cfrom :: forall x.
ScheduledQueryDescription -> Rep ScheduledQueryDescription x
Prelude.Generic)

-- |
-- Create a value of 'ScheduledQueryDescription' 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:
--
-- 'creationTime', 'scheduledQueryDescription_creationTime' - Creation time of the scheduled query.
--
-- 'errorReportConfiguration', 'scheduledQueryDescription_errorReportConfiguration' - Error-reporting configuration for the scheduled query.
--
-- 'kmsKeyId', 'scheduledQueryDescription_kmsKeyId' - A customer provided KMS key used to encrypt the scheduled query
-- resource.
--
-- 'lastRunSummary', 'scheduledQueryDescription_lastRunSummary' - Runtime summary for the last scheduled query run.
--
-- 'nextInvocationTime', 'scheduledQueryDescription_nextInvocationTime' - The next time the scheduled query is scheduled to run.
--
-- 'previousInvocationTime', 'scheduledQueryDescription_previousInvocationTime' - Last time the query was run.
--
-- 'recentlyFailedRuns', 'scheduledQueryDescription_recentlyFailedRuns' - Runtime summary for the last five failed scheduled query runs.
--
-- 'scheduledQueryExecutionRoleArn', 'scheduledQueryDescription_scheduledQueryExecutionRoleArn' - IAM role that Timestream uses to run the schedule query.
--
-- 'targetConfiguration', 'scheduledQueryDescription_targetConfiguration' - Scheduled query target store configuration.
--
-- 'arn', 'scheduledQueryDescription_arn' - Scheduled query ARN.
--
-- 'name', 'scheduledQueryDescription_name' - Name of the scheduled query.
--
-- 'queryString', 'scheduledQueryDescription_queryString' - The query to be run.
--
-- 'state', 'scheduledQueryDescription_state' - State of the scheduled query.
--
-- 'scheduleConfiguration', 'scheduledQueryDescription_scheduleConfiguration' - Schedule configuration.
--
-- 'notificationConfiguration', 'scheduledQueryDescription_notificationConfiguration' - Notification configuration.
newScheduledQueryDescription ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'queryString'
  Prelude.Text ->
  -- | 'state'
  ScheduledQueryState ->
  -- | 'scheduleConfiguration'
  ScheduleConfiguration ->
  -- | 'notificationConfiguration'
  NotificationConfiguration ->
  ScheduledQueryDescription
newScheduledQueryDescription :: Text
-> Text
-> Text
-> ScheduledQueryState
-> ScheduleConfiguration
-> NotificationConfiguration
-> ScheduledQueryDescription
newScheduledQueryDescription
  Text
pArn_
  Text
pName_
  Text
pQueryString_
  ScheduledQueryState
pState_
  ScheduleConfiguration
pScheduleConfiguration_
  NotificationConfiguration
pNotificationConfiguration_ =
    ScheduledQueryDescription'
      { $sel:creationTime:ScheduledQueryDescription' :: Maybe POSIX
creationTime =
          forall a. Maybe a
Prelude.Nothing,
        $sel:errorReportConfiguration:ScheduledQueryDescription' :: Maybe ErrorReportConfiguration
errorReportConfiguration = forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:ScheduledQueryDescription' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
        $sel:lastRunSummary:ScheduledQueryDescription' :: Maybe ScheduledQueryRunSummary
lastRunSummary = forall a. Maybe a
Prelude.Nothing,
        $sel:nextInvocationTime:ScheduledQueryDescription' :: Maybe POSIX
nextInvocationTime = forall a. Maybe a
Prelude.Nothing,
        $sel:previousInvocationTime:ScheduledQueryDescription' :: Maybe POSIX
previousInvocationTime = forall a. Maybe a
Prelude.Nothing,
        $sel:recentlyFailedRuns:ScheduledQueryDescription' :: Maybe [ScheduledQueryRunSummary]
recentlyFailedRuns = forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledQueryExecutionRoleArn:ScheduledQueryDescription' :: Maybe Text
scheduledQueryExecutionRoleArn = forall a. Maybe a
Prelude.Nothing,
        $sel:targetConfiguration:ScheduledQueryDescription' :: Maybe TargetConfiguration
targetConfiguration = forall a. Maybe a
Prelude.Nothing,
        $sel:arn:ScheduledQueryDescription' :: Text
arn = Text
pArn_,
        $sel:name:ScheduledQueryDescription' :: Text
name = Text
pName_,
        $sel:queryString:ScheduledQueryDescription' :: Sensitive Text
queryString =
          forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pQueryString_,
        $sel:state:ScheduledQueryDescription' :: ScheduledQueryState
state = ScheduledQueryState
pState_,
        $sel:scheduleConfiguration:ScheduledQueryDescription' :: ScheduleConfiguration
scheduleConfiguration = ScheduleConfiguration
pScheduleConfiguration_,
        $sel:notificationConfiguration:ScheduledQueryDescription' :: NotificationConfiguration
notificationConfiguration =
          NotificationConfiguration
pNotificationConfiguration_
      }

-- | Creation time of the scheduled query.
scheduledQueryDescription_creationTime :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe Prelude.UTCTime)
scheduledQueryDescription_creationTime :: Lens' ScheduledQueryDescription (Maybe UTCTime)
scheduledQueryDescription_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe POSIX
a -> ScheduledQueryDescription
s {$sel:creationTime:ScheduledQueryDescription' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: ScheduledQueryDescription) 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

-- | Error-reporting configuration for the scheduled query.
scheduledQueryDescription_errorReportConfiguration :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe ErrorReportConfiguration)
scheduledQueryDescription_errorReportConfiguration :: Lens' ScheduledQueryDescription (Maybe ErrorReportConfiguration)
scheduledQueryDescription_errorReportConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe ErrorReportConfiguration
errorReportConfiguration :: Maybe ErrorReportConfiguration
$sel:errorReportConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe ErrorReportConfiguration
errorReportConfiguration} -> Maybe ErrorReportConfiguration
errorReportConfiguration) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe ErrorReportConfiguration
a -> ScheduledQueryDescription
s {$sel:errorReportConfiguration:ScheduledQueryDescription' :: Maybe ErrorReportConfiguration
errorReportConfiguration = Maybe ErrorReportConfiguration
a} :: ScheduledQueryDescription)

-- | A customer provided KMS key used to encrypt the scheduled query
-- resource.
scheduledQueryDescription_kmsKeyId :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe Prelude.Text)
scheduledQueryDescription_kmsKeyId :: Lens' ScheduledQueryDescription (Maybe Text)
scheduledQueryDescription_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe Text
a -> ScheduledQueryDescription
s {$sel:kmsKeyId:ScheduledQueryDescription' :: Maybe Text
kmsKeyId = Maybe Text
a} :: ScheduledQueryDescription)

-- | Runtime summary for the last scheduled query run.
scheduledQueryDescription_lastRunSummary :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe ScheduledQueryRunSummary)
scheduledQueryDescription_lastRunSummary :: Lens' ScheduledQueryDescription (Maybe ScheduledQueryRunSummary)
scheduledQueryDescription_lastRunSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe ScheduledQueryRunSummary
lastRunSummary :: Maybe ScheduledQueryRunSummary
$sel:lastRunSummary:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe ScheduledQueryRunSummary
lastRunSummary} -> Maybe ScheduledQueryRunSummary
lastRunSummary) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe ScheduledQueryRunSummary
a -> ScheduledQueryDescription
s {$sel:lastRunSummary:ScheduledQueryDescription' :: Maybe ScheduledQueryRunSummary
lastRunSummary = Maybe ScheduledQueryRunSummary
a} :: ScheduledQueryDescription)

-- | The next time the scheduled query is scheduled to run.
scheduledQueryDescription_nextInvocationTime :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe Prelude.UTCTime)
scheduledQueryDescription_nextInvocationTime :: Lens' ScheduledQueryDescription (Maybe UTCTime)
scheduledQueryDescription_nextInvocationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe POSIX
nextInvocationTime :: Maybe POSIX
$sel:nextInvocationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
nextInvocationTime} -> Maybe POSIX
nextInvocationTime) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe POSIX
a -> ScheduledQueryDescription
s {$sel:nextInvocationTime:ScheduledQueryDescription' :: Maybe POSIX
nextInvocationTime = Maybe POSIX
a} :: ScheduledQueryDescription) 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

-- | Last time the query was run.
scheduledQueryDescription_previousInvocationTime :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe Prelude.UTCTime)
scheduledQueryDescription_previousInvocationTime :: Lens' ScheduledQueryDescription (Maybe UTCTime)
scheduledQueryDescription_previousInvocationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe POSIX
previousInvocationTime :: Maybe POSIX
$sel:previousInvocationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
previousInvocationTime} -> Maybe POSIX
previousInvocationTime) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe POSIX
a -> ScheduledQueryDescription
s {$sel:previousInvocationTime:ScheduledQueryDescription' :: Maybe POSIX
previousInvocationTime = Maybe POSIX
a} :: ScheduledQueryDescription) 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

-- | Runtime summary for the last five failed scheduled query runs.
scheduledQueryDescription_recentlyFailedRuns :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe [ScheduledQueryRunSummary])
scheduledQueryDescription_recentlyFailedRuns :: Lens' ScheduledQueryDescription (Maybe [ScheduledQueryRunSummary])
scheduledQueryDescription_recentlyFailedRuns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe [ScheduledQueryRunSummary]
recentlyFailedRuns :: Maybe [ScheduledQueryRunSummary]
$sel:recentlyFailedRuns:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe [ScheduledQueryRunSummary]
recentlyFailedRuns} -> Maybe [ScheduledQueryRunSummary]
recentlyFailedRuns) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe [ScheduledQueryRunSummary]
a -> ScheduledQueryDescription
s {$sel:recentlyFailedRuns:ScheduledQueryDescription' :: Maybe [ScheduledQueryRunSummary]
recentlyFailedRuns = Maybe [ScheduledQueryRunSummary]
a} :: ScheduledQueryDescription) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | IAM role that Timestream uses to run the schedule query.
scheduledQueryDescription_scheduledQueryExecutionRoleArn :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe Prelude.Text)
scheduledQueryDescription_scheduledQueryExecutionRoleArn :: Lens' ScheduledQueryDescription (Maybe Text)
scheduledQueryDescription_scheduledQueryExecutionRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe Text
scheduledQueryExecutionRoleArn :: Maybe Text
$sel:scheduledQueryExecutionRoleArn:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe Text
scheduledQueryExecutionRoleArn} -> Maybe Text
scheduledQueryExecutionRoleArn) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe Text
a -> ScheduledQueryDescription
s {$sel:scheduledQueryExecutionRoleArn:ScheduledQueryDescription' :: Maybe Text
scheduledQueryExecutionRoleArn = Maybe Text
a} :: ScheduledQueryDescription)

-- | Scheduled query target store configuration.
scheduledQueryDescription_targetConfiguration :: Lens.Lens' ScheduledQueryDescription (Prelude.Maybe TargetConfiguration)
scheduledQueryDescription_targetConfiguration :: Lens' ScheduledQueryDescription (Maybe TargetConfiguration)
scheduledQueryDescription_targetConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Maybe TargetConfiguration
targetConfiguration :: Maybe TargetConfiguration
$sel:targetConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe TargetConfiguration
targetConfiguration} -> Maybe TargetConfiguration
targetConfiguration) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Maybe TargetConfiguration
a -> ScheduledQueryDescription
s {$sel:targetConfiguration:ScheduledQueryDescription' :: Maybe TargetConfiguration
targetConfiguration = Maybe TargetConfiguration
a} :: ScheduledQueryDescription)

-- | Scheduled query ARN.
scheduledQueryDescription_arn :: Lens.Lens' ScheduledQueryDescription Prelude.Text
scheduledQueryDescription_arn :: Lens' ScheduledQueryDescription Text
scheduledQueryDescription_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Text
arn :: Text
$sel:arn:ScheduledQueryDescription' :: ScheduledQueryDescription -> Text
arn} -> Text
arn) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Text
a -> ScheduledQueryDescription
s {$sel:arn:ScheduledQueryDescription' :: Text
arn = Text
a} :: ScheduledQueryDescription)

-- | Name of the scheduled query.
scheduledQueryDescription_name :: Lens.Lens' ScheduledQueryDescription Prelude.Text
scheduledQueryDescription_name :: Lens' ScheduledQueryDescription Text
scheduledQueryDescription_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Text
name :: Text
$sel:name:ScheduledQueryDescription' :: ScheduledQueryDescription -> Text
name} -> Text
name) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Text
a -> ScheduledQueryDescription
s {$sel:name:ScheduledQueryDescription' :: Text
name = Text
a} :: ScheduledQueryDescription)

-- | The query to be run.
scheduledQueryDescription_queryString :: Lens.Lens' ScheduledQueryDescription Prelude.Text
scheduledQueryDescription_queryString :: Lens' ScheduledQueryDescription Text
scheduledQueryDescription_queryString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {Sensitive Text
queryString :: Sensitive Text
$sel:queryString:ScheduledQueryDescription' :: ScheduledQueryDescription -> Sensitive Text
queryString} -> Sensitive Text
queryString) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} Sensitive Text
a -> ScheduledQueryDescription
s {$sel:queryString:ScheduledQueryDescription' :: Sensitive Text
queryString = Sensitive Text
a} :: ScheduledQueryDescription) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | State of the scheduled query.
scheduledQueryDescription_state :: Lens.Lens' ScheduledQueryDescription ScheduledQueryState
scheduledQueryDescription_state :: Lens' ScheduledQueryDescription ScheduledQueryState
scheduledQueryDescription_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {ScheduledQueryState
state :: ScheduledQueryState
$sel:state:ScheduledQueryDescription' :: ScheduledQueryDescription -> ScheduledQueryState
state} -> ScheduledQueryState
state) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} ScheduledQueryState
a -> ScheduledQueryDescription
s {$sel:state:ScheduledQueryDescription' :: ScheduledQueryState
state = ScheduledQueryState
a} :: ScheduledQueryDescription)

-- | Schedule configuration.
scheduledQueryDescription_scheduleConfiguration :: Lens.Lens' ScheduledQueryDescription ScheduleConfiguration
scheduledQueryDescription_scheduleConfiguration :: Lens' ScheduledQueryDescription ScheduleConfiguration
scheduledQueryDescription_scheduleConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {ScheduleConfiguration
scheduleConfiguration :: ScheduleConfiguration
$sel:scheduleConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> ScheduleConfiguration
scheduleConfiguration} -> ScheduleConfiguration
scheduleConfiguration) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} ScheduleConfiguration
a -> ScheduledQueryDescription
s {$sel:scheduleConfiguration:ScheduledQueryDescription' :: ScheduleConfiguration
scheduleConfiguration = ScheduleConfiguration
a} :: ScheduledQueryDescription)

-- | Notification configuration.
scheduledQueryDescription_notificationConfiguration :: Lens.Lens' ScheduledQueryDescription NotificationConfiguration
scheduledQueryDescription_notificationConfiguration :: Lens' ScheduledQueryDescription NotificationConfiguration
scheduledQueryDescription_notificationConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledQueryDescription' {NotificationConfiguration
notificationConfiguration :: NotificationConfiguration
$sel:notificationConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> NotificationConfiguration
notificationConfiguration} -> NotificationConfiguration
notificationConfiguration) (\s :: ScheduledQueryDescription
s@ScheduledQueryDescription' {} NotificationConfiguration
a -> ScheduledQueryDescription
s {$sel:notificationConfiguration:ScheduledQueryDescription' :: NotificationConfiguration
notificationConfiguration = NotificationConfiguration
a} :: ScheduledQueryDescription)

instance Data.FromJSON ScheduledQueryDescription where
  parseJSON :: Value -> Parser ScheduledQueryDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScheduledQueryDescription"
      ( \Object
x ->
          Maybe POSIX
-> Maybe ErrorReportConfiguration
-> Maybe Text
-> Maybe ScheduledQueryRunSummary
-> Maybe POSIX
-> Maybe POSIX
-> Maybe [ScheduledQueryRunSummary]
-> Maybe Text
-> Maybe TargetConfiguration
-> Text
-> Text
-> Sensitive Text
-> ScheduledQueryState
-> ScheduleConfiguration
-> NotificationConfiguration
-> ScheduledQueryDescription
ScheduledQueryDescription'
            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
"CreationTime")
            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
"ErrorReportConfiguration")
            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
"KmsKeyId")
            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
"LastRunSummary")
            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
"NextInvocationTime")
            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
"PreviousInvocationTime")
            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
"RecentlyFailedRuns"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"ScheduledQueryExecutionRoleArn")
            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
"TargetConfiguration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 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 a
Data..: Key
"QueryString")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 a
Data..: Key
"ScheduleConfiguration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"NotificationConfiguration")
      )

instance Prelude.Hashable ScheduledQueryDescription where
  hashWithSalt :: Int -> ScheduledQueryDescription -> Int
hashWithSalt Int
_salt ScheduledQueryDescription' {Maybe [ScheduledQueryRunSummary]
Maybe Text
Maybe POSIX
Maybe ErrorReportConfiguration
Maybe ScheduledQueryRunSummary
Maybe TargetConfiguration
Text
Sensitive Text
ScheduleConfiguration
ScheduledQueryState
NotificationConfiguration
notificationConfiguration :: NotificationConfiguration
scheduleConfiguration :: ScheduleConfiguration
state :: ScheduledQueryState
queryString :: Sensitive Text
name :: Text
arn :: Text
targetConfiguration :: Maybe TargetConfiguration
scheduledQueryExecutionRoleArn :: Maybe Text
recentlyFailedRuns :: Maybe [ScheduledQueryRunSummary]
previousInvocationTime :: Maybe POSIX
nextInvocationTime :: Maybe POSIX
lastRunSummary :: Maybe ScheduledQueryRunSummary
kmsKeyId :: Maybe Text
errorReportConfiguration :: Maybe ErrorReportConfiguration
creationTime :: Maybe POSIX
$sel:notificationConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> NotificationConfiguration
$sel:scheduleConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> ScheduleConfiguration
$sel:state:ScheduledQueryDescription' :: ScheduledQueryDescription -> ScheduledQueryState
$sel:queryString:ScheduledQueryDescription' :: ScheduledQueryDescription -> Sensitive Text
$sel:name:ScheduledQueryDescription' :: ScheduledQueryDescription -> Text
$sel:arn:ScheduledQueryDescription' :: ScheduledQueryDescription -> Text
$sel:targetConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe TargetConfiguration
$sel:scheduledQueryExecutionRoleArn:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe Text
$sel:recentlyFailedRuns:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe [ScheduledQueryRunSummary]
$sel:previousInvocationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
$sel:nextInvocationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
$sel:lastRunSummary:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe ScheduledQueryRunSummary
$sel:kmsKeyId:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe Text
$sel:errorReportConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe ErrorReportConfiguration
$sel:creationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorReportConfiguration
errorReportConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScheduledQueryRunSummary
lastRunSummary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
nextInvocationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
previousInvocationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ScheduledQueryRunSummary]
recentlyFailedRuns
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scheduledQueryExecutionRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetConfiguration
targetConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
queryString
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScheduledQueryState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScheduleConfiguration
scheduleConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NotificationConfiguration
notificationConfiguration

instance Prelude.NFData ScheduledQueryDescription where
  rnf :: ScheduledQueryDescription -> ()
rnf ScheduledQueryDescription' {Maybe [ScheduledQueryRunSummary]
Maybe Text
Maybe POSIX
Maybe ErrorReportConfiguration
Maybe ScheduledQueryRunSummary
Maybe TargetConfiguration
Text
Sensitive Text
ScheduleConfiguration
ScheduledQueryState
NotificationConfiguration
notificationConfiguration :: NotificationConfiguration
scheduleConfiguration :: ScheduleConfiguration
state :: ScheduledQueryState
queryString :: Sensitive Text
name :: Text
arn :: Text
targetConfiguration :: Maybe TargetConfiguration
scheduledQueryExecutionRoleArn :: Maybe Text
recentlyFailedRuns :: Maybe [ScheduledQueryRunSummary]
previousInvocationTime :: Maybe POSIX
nextInvocationTime :: Maybe POSIX
lastRunSummary :: Maybe ScheduledQueryRunSummary
kmsKeyId :: Maybe Text
errorReportConfiguration :: Maybe ErrorReportConfiguration
creationTime :: Maybe POSIX
$sel:notificationConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> NotificationConfiguration
$sel:scheduleConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> ScheduleConfiguration
$sel:state:ScheduledQueryDescription' :: ScheduledQueryDescription -> ScheduledQueryState
$sel:queryString:ScheduledQueryDescription' :: ScheduledQueryDescription -> Sensitive Text
$sel:name:ScheduledQueryDescription' :: ScheduledQueryDescription -> Text
$sel:arn:ScheduledQueryDescription' :: ScheduledQueryDescription -> Text
$sel:targetConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe TargetConfiguration
$sel:scheduledQueryExecutionRoleArn:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe Text
$sel:recentlyFailedRuns:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe [ScheduledQueryRunSummary]
$sel:previousInvocationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
$sel:nextInvocationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
$sel:lastRunSummary:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe ScheduledQueryRunSummary
$sel:kmsKeyId:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe Text
$sel:errorReportConfiguration:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe ErrorReportConfiguration
$sel:creationTime:ScheduledQueryDescription' :: ScheduledQueryDescription -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorReportConfiguration
errorReportConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScheduledQueryRunSummary
lastRunSummary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
nextInvocationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
previousInvocationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ScheduledQueryRunSummary]
recentlyFailedRuns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scheduledQueryExecutionRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetConfiguration
targetConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
queryString
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScheduledQueryState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScheduleConfiguration
scheduleConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NotificationConfiguration
notificationConfiguration