{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Redshift.EnableLogging
(
EnableLogging (..),
newEnableLogging,
enableLogging_s3KeyPrefix,
enableLogging_clusterIdentifier,
enableLogging_bucketName,
LoggingStatus (..),
newLoggingStatus,
loggingStatus_lastFailureTime,
loggingStatus_lastSuccessfulDeliveryTime,
loggingStatus_s3KeyPrefix,
loggingStatus_bucketName,
loggingStatus_loggingEnabled,
loggingStatus_lastFailureMessage,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data EnableLogging = EnableLogging'
{
EnableLogging -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
EnableLogging -> Text
clusterIdentifier :: Prelude.Text,
EnableLogging -> Text
bucketName :: Prelude.Text
}
deriving (EnableLogging -> EnableLogging -> Bool
(EnableLogging -> EnableLogging -> Bool)
-> (EnableLogging -> EnableLogging -> Bool) -> Eq EnableLogging
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableLogging -> EnableLogging -> Bool
$c/= :: EnableLogging -> EnableLogging -> Bool
== :: EnableLogging -> EnableLogging -> Bool
$c== :: EnableLogging -> EnableLogging -> Bool
Prelude.Eq, ReadPrec [EnableLogging]
ReadPrec EnableLogging
Int -> ReadS EnableLogging
ReadS [EnableLogging]
(Int -> ReadS EnableLogging)
-> ReadS [EnableLogging]
-> ReadPrec EnableLogging
-> ReadPrec [EnableLogging]
-> Read EnableLogging
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableLogging]
$creadListPrec :: ReadPrec [EnableLogging]
readPrec :: ReadPrec EnableLogging
$creadPrec :: ReadPrec EnableLogging
readList :: ReadS [EnableLogging]
$creadList :: ReadS [EnableLogging]
readsPrec :: Int -> ReadS EnableLogging
$creadsPrec :: Int -> ReadS EnableLogging
Prelude.Read, Int -> EnableLogging -> ShowS
[EnableLogging] -> ShowS
EnableLogging -> String
(Int -> EnableLogging -> ShowS)
-> (EnableLogging -> String)
-> ([EnableLogging] -> ShowS)
-> Show EnableLogging
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableLogging] -> ShowS
$cshowList :: [EnableLogging] -> ShowS
show :: EnableLogging -> String
$cshow :: EnableLogging -> String
showsPrec :: Int -> EnableLogging -> ShowS
$cshowsPrec :: Int -> EnableLogging -> ShowS
Prelude.Show, (forall x. EnableLogging -> Rep EnableLogging x)
-> (forall x. Rep EnableLogging x -> EnableLogging)
-> Generic EnableLogging
forall x. Rep EnableLogging x -> EnableLogging
forall x. EnableLogging -> Rep EnableLogging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableLogging x -> EnableLogging
$cfrom :: forall x. EnableLogging -> Rep EnableLogging x
Prelude.Generic)
newEnableLogging ::
Prelude.Text ->
Prelude.Text ->
EnableLogging
newEnableLogging :: Text -> Text -> EnableLogging
newEnableLogging Text
pClusterIdentifier_ Text
pBucketName_ =
EnableLogging' :: Maybe Text -> Text -> Text -> EnableLogging
EnableLogging'
{ $sel:s3KeyPrefix:EnableLogging' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clusterIdentifier:EnableLogging' :: Text
clusterIdentifier = Text
pClusterIdentifier_,
$sel:bucketName:EnableLogging' :: Text
bucketName = Text
pBucketName_
}
enableLogging_s3KeyPrefix :: Lens.Lens' EnableLogging (Prelude.Maybe Prelude.Text)
enableLogging_s3KeyPrefix :: (Maybe Text -> f (Maybe Text)) -> EnableLogging -> f EnableLogging
enableLogging_s3KeyPrefix = (EnableLogging -> Maybe Text)
-> (EnableLogging -> Maybe Text -> EnableLogging)
-> Lens EnableLogging EnableLogging (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableLogging' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:EnableLogging' :: EnableLogging -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: EnableLogging
s@EnableLogging' {} Maybe Text
a -> EnableLogging
s {$sel:s3KeyPrefix:EnableLogging' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: EnableLogging)
enableLogging_clusterIdentifier :: Lens.Lens' EnableLogging Prelude.Text
enableLogging_clusterIdentifier :: (Text -> f Text) -> EnableLogging -> f EnableLogging
enableLogging_clusterIdentifier = (EnableLogging -> Text)
-> (EnableLogging -> Text -> EnableLogging)
-> Lens EnableLogging EnableLogging Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableLogging' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:EnableLogging' :: EnableLogging -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: EnableLogging
s@EnableLogging' {} Text
a -> EnableLogging
s {$sel:clusterIdentifier:EnableLogging' :: Text
clusterIdentifier = Text
a} :: EnableLogging)
enableLogging_bucketName :: Lens.Lens' EnableLogging Prelude.Text
enableLogging_bucketName :: (Text -> f Text) -> EnableLogging -> f EnableLogging
enableLogging_bucketName = (EnableLogging -> Text)
-> (EnableLogging -> Text -> EnableLogging)
-> Lens EnableLogging EnableLogging Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableLogging' {Text
bucketName :: Text
$sel:bucketName:EnableLogging' :: EnableLogging -> Text
bucketName} -> Text
bucketName) (\s :: EnableLogging
s@EnableLogging' {} Text
a -> EnableLogging
s {$sel:bucketName:EnableLogging' :: Text
bucketName = Text
a} :: EnableLogging)
instance Core.AWSRequest EnableLogging where
type AWSResponse EnableLogging = LoggingStatus
request :: EnableLogging -> Request EnableLogging
request = Service -> EnableLogging -> Request EnableLogging
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy EnableLogging
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnableLogging)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse EnableLogging))
-> Logger
-> Service
-> Proxy EnableLogging
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnableLogging)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"EnableLoggingResult"
(\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String LoggingStatus
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
instance Prelude.Hashable EnableLogging
instance Prelude.NFData EnableLogging
instance Core.ToHeaders EnableLogging where
toHeaders :: EnableLogging -> ResponseHeaders
toHeaders = ResponseHeaders -> EnableLogging -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath EnableLogging where
toPath :: EnableLogging -> ByteString
toPath = ByteString -> EnableLogging -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery EnableLogging where
toQuery :: EnableLogging -> QueryString
toQuery EnableLogging' {Maybe Text
Text
bucketName :: Text
clusterIdentifier :: Text
s3KeyPrefix :: Maybe Text
$sel:bucketName:EnableLogging' :: EnableLogging -> Text
$sel:clusterIdentifier:EnableLogging' :: EnableLogging -> Text
$sel:s3KeyPrefix:EnableLogging' :: EnableLogging -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"EnableLogging" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"S3KeyPrefix" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
s3KeyPrefix,
ByteString
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier,
ByteString
"BucketName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
bucketName
]