{-# 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.CloudFront.DeleteRealtimeLogConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a real-time log configuration.
--
-- You cannot delete a real-time log configuration if it\'s attached to a
-- cache behavior. First update your distributions to remove the real-time
-- log configuration from all cache behaviors, then delete the real-time
-- log configuration.
--
-- To delete a real-time log configuration, you can provide the
-- configuration\'s name or its Amazon Resource Name (ARN). You must
-- provide at least one. If you provide both, CloudFront uses the name to
-- identify the real-time log configuration to delete.
module Amazonka.CloudFront.DeleteRealtimeLogConfig
  ( -- * Creating a Request
    DeleteRealtimeLogConfig (..),
    newDeleteRealtimeLogConfig,

    -- * Request Lenses
    deleteRealtimeLogConfig_arn,
    deleteRealtimeLogConfig_name,

    -- * Destructuring the Response
    DeleteRealtimeLogConfigResponse (..),
    newDeleteRealtimeLogConfigResponse,
  )
where

import Amazonka.CloudFront.Types
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteRealtimeLogConfig' smart constructor.
data DeleteRealtimeLogConfig = DeleteRealtimeLogConfig'
  { -- | The Amazon Resource Name (ARN) of the real-time log configuration to
    -- delete.
    DeleteRealtimeLogConfig -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the real-time log configuration to delete.
    DeleteRealtimeLogConfig -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (DeleteRealtimeLogConfig -> DeleteRealtimeLogConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRealtimeLogConfig -> DeleteRealtimeLogConfig -> Bool
$c/= :: DeleteRealtimeLogConfig -> DeleteRealtimeLogConfig -> Bool
== :: DeleteRealtimeLogConfig -> DeleteRealtimeLogConfig -> Bool
$c== :: DeleteRealtimeLogConfig -> DeleteRealtimeLogConfig -> Bool
Prelude.Eq, ReadPrec [DeleteRealtimeLogConfig]
ReadPrec DeleteRealtimeLogConfig
Int -> ReadS DeleteRealtimeLogConfig
ReadS [DeleteRealtimeLogConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRealtimeLogConfig]
$creadListPrec :: ReadPrec [DeleteRealtimeLogConfig]
readPrec :: ReadPrec DeleteRealtimeLogConfig
$creadPrec :: ReadPrec DeleteRealtimeLogConfig
readList :: ReadS [DeleteRealtimeLogConfig]
$creadList :: ReadS [DeleteRealtimeLogConfig]
readsPrec :: Int -> ReadS DeleteRealtimeLogConfig
$creadsPrec :: Int -> ReadS DeleteRealtimeLogConfig
Prelude.Read, Int -> DeleteRealtimeLogConfig -> ShowS
[DeleteRealtimeLogConfig] -> ShowS
DeleteRealtimeLogConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRealtimeLogConfig] -> ShowS
$cshowList :: [DeleteRealtimeLogConfig] -> ShowS
show :: DeleteRealtimeLogConfig -> String
$cshow :: DeleteRealtimeLogConfig -> String
showsPrec :: Int -> DeleteRealtimeLogConfig -> ShowS
$cshowsPrec :: Int -> DeleteRealtimeLogConfig -> ShowS
Prelude.Show, forall x. Rep DeleteRealtimeLogConfig x -> DeleteRealtimeLogConfig
forall x. DeleteRealtimeLogConfig -> Rep DeleteRealtimeLogConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRealtimeLogConfig x -> DeleteRealtimeLogConfig
$cfrom :: forall x. DeleteRealtimeLogConfig -> Rep DeleteRealtimeLogConfig x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRealtimeLogConfig' 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', 'deleteRealtimeLogConfig_arn' - The Amazon Resource Name (ARN) of the real-time log configuration to
-- delete.
--
-- 'name', 'deleteRealtimeLogConfig_name' - The name of the real-time log configuration to delete.
newDeleteRealtimeLogConfig ::
  DeleteRealtimeLogConfig
newDeleteRealtimeLogConfig :: DeleteRealtimeLogConfig
newDeleteRealtimeLogConfig =
  DeleteRealtimeLogConfig'
    { $sel:arn:DeleteRealtimeLogConfig' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:DeleteRealtimeLogConfig' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the real-time log configuration to
-- delete.
deleteRealtimeLogConfig_arn :: Lens.Lens' DeleteRealtimeLogConfig (Prelude.Maybe Prelude.Text)
deleteRealtimeLogConfig_arn :: Lens' DeleteRealtimeLogConfig (Maybe Text)
deleteRealtimeLogConfig_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRealtimeLogConfig' {Maybe Text
arn :: Maybe Text
$sel:arn:DeleteRealtimeLogConfig' :: DeleteRealtimeLogConfig -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeleteRealtimeLogConfig
s@DeleteRealtimeLogConfig' {} Maybe Text
a -> DeleteRealtimeLogConfig
s {$sel:arn:DeleteRealtimeLogConfig' :: Maybe Text
arn = Maybe Text
a} :: DeleteRealtimeLogConfig)

-- | The name of the real-time log configuration to delete.
deleteRealtimeLogConfig_name :: Lens.Lens' DeleteRealtimeLogConfig (Prelude.Maybe Prelude.Text)
deleteRealtimeLogConfig_name :: Lens' DeleteRealtimeLogConfig (Maybe Text)
deleteRealtimeLogConfig_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRealtimeLogConfig' {Maybe Text
name :: Maybe Text
$sel:name:DeleteRealtimeLogConfig' :: DeleteRealtimeLogConfig -> Maybe Text
name} -> Maybe Text
name) (\s :: DeleteRealtimeLogConfig
s@DeleteRealtimeLogConfig' {} Maybe Text
a -> DeleteRealtimeLogConfig
s {$sel:name:DeleteRealtimeLogConfig' :: Maybe Text
name = Maybe Text
a} :: DeleteRealtimeLogConfig)

instance Core.AWSRequest DeleteRealtimeLogConfig where
  type
    AWSResponse DeleteRealtimeLogConfig =
      DeleteRealtimeLogConfigResponse
  request :: (Service -> Service)
-> DeleteRealtimeLogConfig -> Request DeleteRealtimeLogConfig
request Service -> Service
overrides =
    forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteRealtimeLogConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRealtimeLogConfig)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteRealtimeLogConfigResponse
DeleteRealtimeLogConfigResponse'

instance Prelude.Hashable DeleteRealtimeLogConfig where
  hashWithSalt :: Int -> DeleteRealtimeLogConfig -> Int
hashWithSalt Int
_salt DeleteRealtimeLogConfig' {Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:name:DeleteRealtimeLogConfig' :: DeleteRealtimeLogConfig -> Maybe Text
$sel:arn:DeleteRealtimeLogConfig' :: DeleteRealtimeLogConfig -> 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 Text
name

instance Prelude.NFData DeleteRealtimeLogConfig where
  rnf :: DeleteRealtimeLogConfig -> ()
rnf DeleteRealtimeLogConfig' {Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:name:DeleteRealtimeLogConfig' :: DeleteRealtimeLogConfig -> Maybe Text
$sel:arn:DeleteRealtimeLogConfig' :: DeleteRealtimeLogConfig -> 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 Text
name

instance Data.ToElement DeleteRealtimeLogConfig where
  toElement :: DeleteRealtimeLogConfig -> Element
toElement =
    forall a. ToXML a => Name -> a -> Element
Data.mkElement
      Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}DeleteRealtimeLogConfigRequest"

instance Data.ToHeaders DeleteRealtimeLogConfig where
  toHeaders :: DeleteRealtimeLogConfig -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DeleteRealtimeLogConfig where
  toPath :: DeleteRealtimeLogConfig -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/2020-05-31/delete-realtime-log-config/"

instance Data.ToQuery DeleteRealtimeLogConfig where
  toQuery :: DeleteRealtimeLogConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToXML DeleteRealtimeLogConfig where
  toXML :: DeleteRealtimeLogConfig -> XML
toXML DeleteRealtimeLogConfig' {Maybe Text
name :: Maybe Text
arn :: Maybe Text
$sel:name:DeleteRealtimeLogConfig' :: DeleteRealtimeLogConfig -> Maybe Text
$sel:arn:DeleteRealtimeLogConfig' :: DeleteRealtimeLogConfig -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [Name
"ARN" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
arn, Name
"Name" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
name]

-- | /See:/ 'newDeleteRealtimeLogConfigResponse' smart constructor.
data DeleteRealtimeLogConfigResponse = DeleteRealtimeLogConfigResponse'
  {
  }
  deriving (DeleteRealtimeLogConfigResponse
-> DeleteRealtimeLogConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRealtimeLogConfigResponse
-> DeleteRealtimeLogConfigResponse -> Bool
$c/= :: DeleteRealtimeLogConfigResponse
-> DeleteRealtimeLogConfigResponse -> Bool
== :: DeleteRealtimeLogConfigResponse
-> DeleteRealtimeLogConfigResponse -> Bool
$c== :: DeleteRealtimeLogConfigResponse
-> DeleteRealtimeLogConfigResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRealtimeLogConfigResponse]
ReadPrec DeleteRealtimeLogConfigResponse
Int -> ReadS DeleteRealtimeLogConfigResponse
ReadS [DeleteRealtimeLogConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRealtimeLogConfigResponse]
$creadListPrec :: ReadPrec [DeleteRealtimeLogConfigResponse]
readPrec :: ReadPrec DeleteRealtimeLogConfigResponse
$creadPrec :: ReadPrec DeleteRealtimeLogConfigResponse
readList :: ReadS [DeleteRealtimeLogConfigResponse]
$creadList :: ReadS [DeleteRealtimeLogConfigResponse]
readsPrec :: Int -> ReadS DeleteRealtimeLogConfigResponse
$creadsPrec :: Int -> ReadS DeleteRealtimeLogConfigResponse
Prelude.Read, Int -> DeleteRealtimeLogConfigResponse -> ShowS
[DeleteRealtimeLogConfigResponse] -> ShowS
DeleteRealtimeLogConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRealtimeLogConfigResponse] -> ShowS
$cshowList :: [DeleteRealtimeLogConfigResponse] -> ShowS
show :: DeleteRealtimeLogConfigResponse -> String
$cshow :: DeleteRealtimeLogConfigResponse -> String
showsPrec :: Int -> DeleteRealtimeLogConfigResponse -> ShowS
$cshowsPrec :: Int -> DeleteRealtimeLogConfigResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteRealtimeLogConfigResponse x
-> DeleteRealtimeLogConfigResponse
forall x.
DeleteRealtimeLogConfigResponse
-> Rep DeleteRealtimeLogConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteRealtimeLogConfigResponse x
-> DeleteRealtimeLogConfigResponse
$cfrom :: forall x.
DeleteRealtimeLogConfigResponse
-> Rep DeleteRealtimeLogConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRealtimeLogConfigResponse' 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.
newDeleteRealtimeLogConfigResponse ::
  DeleteRealtimeLogConfigResponse
newDeleteRealtimeLogConfigResponse :: DeleteRealtimeLogConfigResponse
newDeleteRealtimeLogConfigResponse =
  DeleteRealtimeLogConfigResponse
DeleteRealtimeLogConfigResponse'

instance
  Prelude.NFData
    DeleteRealtimeLogConfigResponse
  where
  rnf :: DeleteRealtimeLogConfigResponse -> ()
rnf DeleteRealtimeLogConfigResponse
_ = ()