{-# 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.CloudWatchLogs.DeleteDataProtectionPolicy
-- 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 the data protection policy from the specified log group.
--
-- For more information about data protection policies, see
-- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDataProtectionPolicy.html PutDataProtectionPolicy>.
module Amazonka.CloudWatchLogs.DeleteDataProtectionPolicy
  ( -- * Creating a Request
    DeleteDataProtectionPolicy (..),
    newDeleteDataProtectionPolicy,

    -- * Request Lenses
    deleteDataProtectionPolicy_logGroupIdentifier,

    -- * Destructuring the Response
    DeleteDataProtectionPolicyResponse (..),
    newDeleteDataProtectionPolicyResponse,
  )
where

import Amazonka.CloudWatchLogs.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:/ 'newDeleteDataProtectionPolicy' smart constructor.
data DeleteDataProtectionPolicy = DeleteDataProtectionPolicy'
  { -- | The name or ARN of the log group that you want to delete the data
    -- protection policy for.
    DeleteDataProtectionPolicy -> Text
logGroupIdentifier :: Prelude.Text
  }
  deriving (DeleteDataProtectionPolicy -> DeleteDataProtectionPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDataProtectionPolicy -> DeleteDataProtectionPolicy -> Bool
$c/= :: DeleteDataProtectionPolicy -> DeleteDataProtectionPolicy -> Bool
== :: DeleteDataProtectionPolicy -> DeleteDataProtectionPolicy -> Bool
$c== :: DeleteDataProtectionPolicy -> DeleteDataProtectionPolicy -> Bool
Prelude.Eq, ReadPrec [DeleteDataProtectionPolicy]
ReadPrec DeleteDataProtectionPolicy
Int -> ReadS DeleteDataProtectionPolicy
ReadS [DeleteDataProtectionPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDataProtectionPolicy]
$creadListPrec :: ReadPrec [DeleteDataProtectionPolicy]
readPrec :: ReadPrec DeleteDataProtectionPolicy
$creadPrec :: ReadPrec DeleteDataProtectionPolicy
readList :: ReadS [DeleteDataProtectionPolicy]
$creadList :: ReadS [DeleteDataProtectionPolicy]
readsPrec :: Int -> ReadS DeleteDataProtectionPolicy
$creadsPrec :: Int -> ReadS DeleteDataProtectionPolicy
Prelude.Read, Int -> DeleteDataProtectionPolicy -> ShowS
[DeleteDataProtectionPolicy] -> ShowS
DeleteDataProtectionPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDataProtectionPolicy] -> ShowS
$cshowList :: [DeleteDataProtectionPolicy] -> ShowS
show :: DeleteDataProtectionPolicy -> String
$cshow :: DeleteDataProtectionPolicy -> String
showsPrec :: Int -> DeleteDataProtectionPolicy -> ShowS
$cshowsPrec :: Int -> DeleteDataProtectionPolicy -> ShowS
Prelude.Show, forall x.
Rep DeleteDataProtectionPolicy x -> DeleteDataProtectionPolicy
forall x.
DeleteDataProtectionPolicy -> Rep DeleteDataProtectionPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDataProtectionPolicy x -> DeleteDataProtectionPolicy
$cfrom :: forall x.
DeleteDataProtectionPolicy -> Rep DeleteDataProtectionPolicy x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDataProtectionPolicy' 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:
--
-- 'logGroupIdentifier', 'deleteDataProtectionPolicy_logGroupIdentifier' - The name or ARN of the log group that you want to delete the data
-- protection policy for.
newDeleteDataProtectionPolicy ::
  -- | 'logGroupIdentifier'
  Prelude.Text ->
  DeleteDataProtectionPolicy
newDeleteDataProtectionPolicy :: Text -> DeleteDataProtectionPolicy
newDeleteDataProtectionPolicy Text
pLogGroupIdentifier_ =
  DeleteDataProtectionPolicy'
    { $sel:logGroupIdentifier:DeleteDataProtectionPolicy' :: Text
logGroupIdentifier =
        Text
pLogGroupIdentifier_
    }

-- | The name or ARN of the log group that you want to delete the data
-- protection policy for.
deleteDataProtectionPolicy_logGroupIdentifier :: Lens.Lens' DeleteDataProtectionPolicy Prelude.Text
deleteDataProtectionPolicy_logGroupIdentifier :: Lens' DeleteDataProtectionPolicy Text
deleteDataProtectionPolicy_logGroupIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDataProtectionPolicy' {Text
logGroupIdentifier :: Text
$sel:logGroupIdentifier:DeleteDataProtectionPolicy' :: DeleteDataProtectionPolicy -> Text
logGroupIdentifier} -> Text
logGroupIdentifier) (\s :: DeleteDataProtectionPolicy
s@DeleteDataProtectionPolicy' {} Text
a -> DeleteDataProtectionPolicy
s {$sel:logGroupIdentifier:DeleteDataProtectionPolicy' :: Text
logGroupIdentifier = Text
a} :: DeleteDataProtectionPolicy)

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

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

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

instance Data.ToHeaders DeleteDataProtectionPolicy where
  toHeaders :: DeleteDataProtectionPolicy -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"Logs_20140328.DeleteDataProtectionPolicy" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteDataProtectionPolicy where
  toJSON :: DeleteDataProtectionPolicy -> Value
toJSON DeleteDataProtectionPolicy' {Text
logGroupIdentifier :: Text
$sel:logGroupIdentifier:DeleteDataProtectionPolicy' :: DeleteDataProtectionPolicy -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"logGroupIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
logGroupIdentifier)
          ]
      )

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

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

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

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

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