{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Redshift.DisableLogging
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops logging information, such as queries and connection attempts, for
-- the specified Amazon Redshift cluster.
module Amazonka.Redshift.DisableLogging
  ( -- * Creating a Request
    DisableLogging (..),
    newDisableLogging,

    -- * Request Lenses
    disableLogging_clusterIdentifier,

    -- * Destructuring the Response
    LoggingStatus (..),
    newLoggingStatus,

    -- * Response Lenses
    loggingStatus_bucketName,
    loggingStatus_lastFailureMessage,
    loggingStatus_lastFailureTime,
    loggingStatus_lastSuccessfulDeliveryTime,
    loggingStatus_logDestinationType,
    loggingStatus_logExports,
    loggingStatus_loggingEnabled,
    loggingStatus_s3KeyPrefix,
  )
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.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newDisableLogging' smart constructor.
data DisableLogging = DisableLogging'
  { -- | The identifier of the cluster on which logging is to be stopped.
    --
    -- Example: @examplecluster@
    DisableLogging -> Text
clusterIdentifier :: Prelude.Text
  }
  deriving (DisableLogging -> DisableLogging -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableLogging -> DisableLogging -> Bool
$c/= :: DisableLogging -> DisableLogging -> Bool
== :: DisableLogging -> DisableLogging -> Bool
$c== :: DisableLogging -> DisableLogging -> Bool
Prelude.Eq, ReadPrec [DisableLogging]
ReadPrec DisableLogging
Int -> ReadS DisableLogging
ReadS [DisableLogging]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableLogging]
$creadListPrec :: ReadPrec [DisableLogging]
readPrec :: ReadPrec DisableLogging
$creadPrec :: ReadPrec DisableLogging
readList :: ReadS [DisableLogging]
$creadList :: ReadS [DisableLogging]
readsPrec :: Int -> ReadS DisableLogging
$creadsPrec :: Int -> ReadS DisableLogging
Prelude.Read, Int -> DisableLogging -> ShowS
[DisableLogging] -> ShowS
DisableLogging -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableLogging] -> ShowS
$cshowList :: [DisableLogging] -> ShowS
show :: DisableLogging -> String
$cshow :: DisableLogging -> String
showsPrec :: Int -> DisableLogging -> ShowS
$cshowsPrec :: Int -> DisableLogging -> ShowS
Prelude.Show, forall x. Rep DisableLogging x -> DisableLogging
forall x. DisableLogging -> Rep DisableLogging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableLogging x -> DisableLogging
$cfrom :: forall x. DisableLogging -> Rep DisableLogging x
Prelude.Generic)

-- |
-- Create a value of 'DisableLogging' 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:
--
-- 'clusterIdentifier', 'disableLogging_clusterIdentifier' - The identifier of the cluster on which logging is to be stopped.
--
-- Example: @examplecluster@
newDisableLogging ::
  -- | 'clusterIdentifier'
  Prelude.Text ->
  DisableLogging
newDisableLogging :: Text -> DisableLogging
newDisableLogging Text
pClusterIdentifier_ =
  DisableLogging'
    { $sel:clusterIdentifier:DisableLogging' :: Text
clusterIdentifier =
        Text
pClusterIdentifier_
    }

-- | The identifier of the cluster on which logging is to be stopped.
--
-- Example: @examplecluster@
disableLogging_clusterIdentifier :: Lens.Lens' DisableLogging Prelude.Text
disableLogging_clusterIdentifier :: Lens' DisableLogging Text
disableLogging_clusterIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableLogging' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:DisableLogging' :: DisableLogging -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: DisableLogging
s@DisableLogging' {} Text
a -> DisableLogging
s {$sel:clusterIdentifier:DisableLogging' :: Text
clusterIdentifier = Text
a} :: DisableLogging)

instance Core.AWSRequest DisableLogging where
  type AWSResponse DisableLogging = LoggingStatus
  request :: (Service -> Service) -> DisableLogging -> Request DisableLogging
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisableLogging
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableLogging)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DisableLoggingResult"
      (\Int
s ResponseHeaders
h [Node]
x -> forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)

instance Prelude.Hashable DisableLogging where
  hashWithSalt :: Int -> DisableLogging -> Int
hashWithSalt Int
_salt DisableLogging' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:DisableLogging' :: DisableLogging -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterIdentifier

instance Prelude.NFData DisableLogging where
  rnf :: DisableLogging -> ()
rnf DisableLogging' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:DisableLogging' :: DisableLogging -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
clusterIdentifier

instance Data.ToHeaders DisableLogging where
  toHeaders :: DisableLogging -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DisableLogging where
  toPath :: DisableLogging -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery DisableLogging where
  toQuery :: DisableLogging -> QueryString
toQuery DisableLogging' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:DisableLogging' :: DisableLogging -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DisableLogging" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"ClusterIdentifier" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
clusterIdentifier
      ]