{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteRealtimeLogConfig -> DeleteRealtimeLogConfig -> Bool)
-> (DeleteRealtimeLogConfig -> DeleteRealtimeLogConfig -> Bool)
-> Eq DeleteRealtimeLogConfig
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]
(Int -> ReadS DeleteRealtimeLogConfig)
-> ReadS [DeleteRealtimeLogConfig]
-> ReadPrec DeleteRealtimeLogConfig
-> ReadPrec [DeleteRealtimeLogConfig]
-> Read 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
(Int -> DeleteRealtimeLogConfig -> ShowS)
-> (DeleteRealtimeLogConfig -> String)
-> ([DeleteRealtimeLogConfig] -> ShowS)
-> Show DeleteRealtimeLogConfig
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.
 DeleteRealtimeLogConfig -> Rep DeleteRealtimeLogConfig x)
-> (forall x.
    Rep DeleteRealtimeLogConfig x -> DeleteRealtimeLogConfig)
-> Generic DeleteRealtimeLogConfig
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' :: Maybe Text -> Maybe Text -> DeleteRealtimeLogConfig
DeleteRealtimeLogConfig'
    { $sel:arn:DeleteRealtimeLogConfig' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DeleteRealtimeLogConfig' :: Maybe Text
name = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteRealtimeLogConfig -> f DeleteRealtimeLogConfig
deleteRealtimeLogConfig_arn = (DeleteRealtimeLogConfig -> Maybe Text)
-> (DeleteRealtimeLogConfig
    -> Maybe Text -> DeleteRealtimeLogConfig)
-> Lens
     DeleteRealtimeLogConfig
     DeleteRealtimeLogConfig
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteRealtimeLogConfig -> f DeleteRealtimeLogConfig
deleteRealtimeLogConfig_name = (DeleteRealtimeLogConfig -> Maybe Text)
-> (DeleteRealtimeLogConfig
    -> Maybe Text -> DeleteRealtimeLogConfig)
-> Lens
     DeleteRealtimeLogConfig
     DeleteRealtimeLogConfig
     (Maybe Text)
     (Maybe Text)
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 :: DeleteRealtimeLogConfig -> Request DeleteRealtimeLogConfig
request = Service
-> DeleteRealtimeLogConfig -> Request DeleteRealtimeLogConfig
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteRealtimeLogConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRealtimeLogConfig)))
response =
    AWSResponse DeleteRealtimeLogConfig
-> Logger
-> Service
-> Proxy DeleteRealtimeLogConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRealtimeLogConfig)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteRealtimeLogConfig
DeleteRealtimeLogConfigResponse
DeleteRealtimeLogConfigResponse'

instance Prelude.Hashable DeleteRealtimeLogConfig

instance Prelude.NFData DeleteRealtimeLogConfig

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

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

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

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

instance Core.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
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [Name
"ARN" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
arn, Name
"Name" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
name]

-- | /See:/ 'newDeleteRealtimeLogConfigResponse' smart constructor.
data DeleteRealtimeLogConfigResponse = DeleteRealtimeLogConfigResponse'
  {
  }
  deriving (DeleteRealtimeLogConfigResponse
-> DeleteRealtimeLogConfigResponse -> Bool
(DeleteRealtimeLogConfigResponse
 -> DeleteRealtimeLogConfigResponse -> Bool)
-> (DeleteRealtimeLogConfigResponse
    -> DeleteRealtimeLogConfigResponse -> Bool)
-> Eq DeleteRealtimeLogConfigResponse
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]
(Int -> ReadS DeleteRealtimeLogConfigResponse)
-> ReadS [DeleteRealtimeLogConfigResponse]
-> ReadPrec DeleteRealtimeLogConfigResponse
-> ReadPrec [DeleteRealtimeLogConfigResponse]
-> Read 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
(Int -> DeleteRealtimeLogConfigResponse -> ShowS)
-> (DeleteRealtimeLogConfigResponse -> String)
-> ([DeleteRealtimeLogConfigResponse] -> ShowS)
-> Show DeleteRealtimeLogConfigResponse
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.
 DeleteRealtimeLogConfigResponse
 -> Rep DeleteRealtimeLogConfigResponse x)
-> (forall x.
    Rep DeleteRealtimeLogConfigResponse x
    -> DeleteRealtimeLogConfigResponse)
-> Generic DeleteRealtimeLogConfigResponse
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