{-# 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.Redshift.Types.LoggingStatus
-- 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.Redshift.Types.LoggingStatus where

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

-- | Describes the status of logging for a cluster.
--
-- /See:/ 'newLoggingStatus' smart constructor.
data LoggingStatus = LoggingStatus'
  { -- | The last time when logs failed to be delivered.
    LoggingStatus -> Maybe ISO8601
lastFailureTime :: Prelude.Maybe Core.ISO8601,
    -- | The last time that logs were delivered.
    LoggingStatus -> Maybe ISO8601
lastSuccessfulDeliveryTime :: Prelude.Maybe Core.ISO8601,
    -- | The prefix applied to the log file names.
    LoggingStatus -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The name of the S3 bucket where the log files are stored.
    LoggingStatus -> Maybe Text
bucketName :: Prelude.Maybe Prelude.Text,
    -- | @true@ if logging is on, @false@ if logging is off.
    LoggingStatus -> Maybe Bool
loggingEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The message indicating that logs failed to be delivered.
    LoggingStatus -> Maybe Text
lastFailureMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (LoggingStatus -> LoggingStatus -> Bool
(LoggingStatus -> LoggingStatus -> Bool)
-> (LoggingStatus -> LoggingStatus -> Bool) -> Eq LoggingStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingStatus -> LoggingStatus -> Bool
$c/= :: LoggingStatus -> LoggingStatus -> Bool
== :: LoggingStatus -> LoggingStatus -> Bool
$c== :: LoggingStatus -> LoggingStatus -> Bool
Prelude.Eq, ReadPrec [LoggingStatus]
ReadPrec LoggingStatus
Int -> ReadS LoggingStatus
ReadS [LoggingStatus]
(Int -> ReadS LoggingStatus)
-> ReadS [LoggingStatus]
-> ReadPrec LoggingStatus
-> ReadPrec [LoggingStatus]
-> Read LoggingStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingStatus]
$creadListPrec :: ReadPrec [LoggingStatus]
readPrec :: ReadPrec LoggingStatus
$creadPrec :: ReadPrec LoggingStatus
readList :: ReadS [LoggingStatus]
$creadList :: ReadS [LoggingStatus]
readsPrec :: Int -> ReadS LoggingStatus
$creadsPrec :: Int -> ReadS LoggingStatus
Prelude.Read, Int -> LoggingStatus -> ShowS
[LoggingStatus] -> ShowS
LoggingStatus -> String
(Int -> LoggingStatus -> ShowS)
-> (LoggingStatus -> String)
-> ([LoggingStatus] -> ShowS)
-> Show LoggingStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingStatus] -> ShowS
$cshowList :: [LoggingStatus] -> ShowS
show :: LoggingStatus -> String
$cshow :: LoggingStatus -> String
showsPrec :: Int -> LoggingStatus -> ShowS
$cshowsPrec :: Int -> LoggingStatus -> ShowS
Prelude.Show, (forall x. LoggingStatus -> Rep LoggingStatus x)
-> (forall x. Rep LoggingStatus x -> LoggingStatus)
-> Generic LoggingStatus
forall x. Rep LoggingStatus x -> LoggingStatus
forall x. LoggingStatus -> Rep LoggingStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingStatus x -> LoggingStatus
$cfrom :: forall x. LoggingStatus -> Rep LoggingStatus x
Prelude.Generic)

-- |
-- Create a value of 'LoggingStatus' 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:
--
-- 'lastFailureTime', 'loggingStatus_lastFailureTime' - The last time when logs failed to be delivered.
--
-- 'lastSuccessfulDeliveryTime', 'loggingStatus_lastSuccessfulDeliveryTime' - The last time that logs were delivered.
--
-- 's3KeyPrefix', 'loggingStatus_s3KeyPrefix' - The prefix applied to the log file names.
--
-- 'bucketName', 'loggingStatus_bucketName' - The name of the S3 bucket where the log files are stored.
--
-- 'loggingEnabled', 'loggingStatus_loggingEnabled' - @true@ if logging is on, @false@ if logging is off.
--
-- 'lastFailureMessage', 'loggingStatus_lastFailureMessage' - The message indicating that logs failed to be delivered.
newLoggingStatus ::
  LoggingStatus
newLoggingStatus :: LoggingStatus
newLoggingStatus =
  LoggingStatus' :: Maybe ISO8601
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> LoggingStatus
LoggingStatus'
    { $sel:lastFailureTime:LoggingStatus' :: Maybe ISO8601
lastFailureTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:lastSuccessfulDeliveryTime:LoggingStatus' :: Maybe ISO8601
lastSuccessfulDeliveryTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:s3KeyPrefix:LoggingStatus' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucketName:LoggingStatus' :: Maybe Text
bucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:loggingEnabled:LoggingStatus' :: Maybe Bool
loggingEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:lastFailureMessage:LoggingStatus' :: Maybe Text
lastFailureMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The last time when logs failed to be delivered.
loggingStatus_lastFailureTime :: Lens.Lens' LoggingStatus (Prelude.Maybe Prelude.UTCTime)
loggingStatus_lastFailureTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LoggingStatus -> f LoggingStatus
loggingStatus_lastFailureTime = (LoggingStatus -> Maybe ISO8601)
-> (LoggingStatus -> Maybe ISO8601 -> LoggingStatus)
-> Lens LoggingStatus LoggingStatus (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingStatus' {Maybe ISO8601
lastFailureTime :: Maybe ISO8601
$sel:lastFailureTime:LoggingStatus' :: LoggingStatus -> Maybe ISO8601
lastFailureTime} -> Maybe ISO8601
lastFailureTime) (\s :: LoggingStatus
s@LoggingStatus' {} Maybe ISO8601
a -> LoggingStatus
s {$sel:lastFailureTime:LoggingStatus' :: Maybe ISO8601
lastFailureTime = Maybe ISO8601
a} :: LoggingStatus) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> LoggingStatus -> f LoggingStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LoggingStatus
-> f LoggingStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The last time that logs were delivered.
loggingStatus_lastSuccessfulDeliveryTime :: Lens.Lens' LoggingStatus (Prelude.Maybe Prelude.UTCTime)
loggingStatus_lastSuccessfulDeliveryTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LoggingStatus -> f LoggingStatus
loggingStatus_lastSuccessfulDeliveryTime = (LoggingStatus -> Maybe ISO8601)
-> (LoggingStatus -> Maybe ISO8601 -> LoggingStatus)
-> Lens LoggingStatus LoggingStatus (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingStatus' {Maybe ISO8601
lastSuccessfulDeliveryTime :: Maybe ISO8601
$sel:lastSuccessfulDeliveryTime:LoggingStatus' :: LoggingStatus -> Maybe ISO8601
lastSuccessfulDeliveryTime} -> Maybe ISO8601
lastSuccessfulDeliveryTime) (\s :: LoggingStatus
s@LoggingStatus' {} Maybe ISO8601
a -> LoggingStatus
s {$sel:lastSuccessfulDeliveryTime:LoggingStatus' :: Maybe ISO8601
lastSuccessfulDeliveryTime = Maybe ISO8601
a} :: LoggingStatus) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> LoggingStatus -> f LoggingStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LoggingStatus
-> f LoggingStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The prefix applied to the log file names.
loggingStatus_s3KeyPrefix :: Lens.Lens' LoggingStatus (Prelude.Maybe Prelude.Text)
loggingStatus_s3KeyPrefix :: (Maybe Text -> f (Maybe Text)) -> LoggingStatus -> f LoggingStatus
loggingStatus_s3KeyPrefix = (LoggingStatus -> Maybe Text)
-> (LoggingStatus -> Maybe Text -> LoggingStatus)
-> Lens LoggingStatus LoggingStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingStatus' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:LoggingStatus' :: LoggingStatus -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: LoggingStatus
s@LoggingStatus' {} Maybe Text
a -> LoggingStatus
s {$sel:s3KeyPrefix:LoggingStatus' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: LoggingStatus)

-- | The name of the S3 bucket where the log files are stored.
loggingStatus_bucketName :: Lens.Lens' LoggingStatus (Prelude.Maybe Prelude.Text)
loggingStatus_bucketName :: (Maybe Text -> f (Maybe Text)) -> LoggingStatus -> f LoggingStatus
loggingStatus_bucketName = (LoggingStatus -> Maybe Text)
-> (LoggingStatus -> Maybe Text -> LoggingStatus)
-> Lens LoggingStatus LoggingStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingStatus' {Maybe Text
bucketName :: Maybe Text
$sel:bucketName:LoggingStatus' :: LoggingStatus -> Maybe Text
bucketName} -> Maybe Text
bucketName) (\s :: LoggingStatus
s@LoggingStatus' {} Maybe Text
a -> LoggingStatus
s {$sel:bucketName:LoggingStatus' :: Maybe Text
bucketName = Maybe Text
a} :: LoggingStatus)

-- | @true@ if logging is on, @false@ if logging is off.
loggingStatus_loggingEnabled :: Lens.Lens' LoggingStatus (Prelude.Maybe Prelude.Bool)
loggingStatus_loggingEnabled :: (Maybe Bool -> f (Maybe Bool)) -> LoggingStatus -> f LoggingStatus
loggingStatus_loggingEnabled = (LoggingStatus -> Maybe Bool)
-> (LoggingStatus -> Maybe Bool -> LoggingStatus)
-> Lens LoggingStatus LoggingStatus (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingStatus' {Maybe Bool
loggingEnabled :: Maybe Bool
$sel:loggingEnabled:LoggingStatus' :: LoggingStatus -> Maybe Bool
loggingEnabled} -> Maybe Bool
loggingEnabled) (\s :: LoggingStatus
s@LoggingStatus' {} Maybe Bool
a -> LoggingStatus
s {$sel:loggingEnabled:LoggingStatus' :: Maybe Bool
loggingEnabled = Maybe Bool
a} :: LoggingStatus)

-- | The message indicating that logs failed to be delivered.
loggingStatus_lastFailureMessage :: Lens.Lens' LoggingStatus (Prelude.Maybe Prelude.Text)
loggingStatus_lastFailureMessage :: (Maybe Text -> f (Maybe Text)) -> LoggingStatus -> f LoggingStatus
loggingStatus_lastFailureMessage = (LoggingStatus -> Maybe Text)
-> (LoggingStatus -> Maybe Text -> LoggingStatus)
-> Lens LoggingStatus LoggingStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingStatus' {Maybe Text
lastFailureMessage :: Maybe Text
$sel:lastFailureMessage:LoggingStatus' :: LoggingStatus -> Maybe Text
lastFailureMessage} -> Maybe Text
lastFailureMessage) (\s :: LoggingStatus
s@LoggingStatus' {} Maybe Text
a -> LoggingStatus
s {$sel:lastFailureMessage:LoggingStatus' :: Maybe Text
lastFailureMessage = Maybe Text
a} :: LoggingStatus)

instance Core.FromXML LoggingStatus where
  parseXML :: [Node] -> Either String LoggingStatus
parseXML [Node]
x =
    Maybe ISO8601
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> LoggingStatus
LoggingStatus'
      (Maybe ISO8601
 -> Maybe ISO8601
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> LoggingStatus)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> LoggingStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LastFailureTime")
      Either
  String
  (Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> LoggingStatus)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Bool -> Maybe Text -> LoggingStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LastSuccessfulDeliveryTime")
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Bool -> Maybe Text -> LoggingStatus)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Bool -> Maybe Text -> LoggingStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"S3KeyPrefix")
      Either
  String (Maybe Text -> Maybe Bool -> Maybe Text -> LoggingStatus)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Maybe Text -> LoggingStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"BucketName")
      Either String (Maybe Bool -> Maybe Text -> LoggingStatus)
-> Either String (Maybe Bool)
-> Either String (Maybe Text -> LoggingStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LoggingEnabled")
      Either String (Maybe Text -> LoggingStatus)
-> Either String (Maybe Text) -> Either String LoggingStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LastFailureMessage")

instance Prelude.Hashable LoggingStatus

instance Prelude.NFData LoggingStatus