{-# 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.DeleteMonitoringSubscription
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disables additional CloudWatch metrics for the specified CloudFront
-- distribution.
module Amazonka.CloudFront.DeleteMonitoringSubscription
  ( -- * Creating a Request
    DeleteMonitoringSubscription (..),
    newDeleteMonitoringSubscription,

    -- * Request Lenses
    deleteMonitoringSubscription_distributionId,

    -- * Destructuring the Response
    DeleteMonitoringSubscriptionResponse (..),
    newDeleteMonitoringSubscriptionResponse,

    -- * Response Lenses
    deleteMonitoringSubscriptionResponse_httpStatus,
  )
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:/ 'newDeleteMonitoringSubscription' smart constructor.
data DeleteMonitoringSubscription = DeleteMonitoringSubscription'
  { -- | The ID of the distribution that you are disabling metrics for.
    DeleteMonitoringSubscription -> Text
distributionId :: Prelude.Text
  }
  deriving (DeleteMonitoringSubscription
-> DeleteMonitoringSubscription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMonitoringSubscription
-> DeleteMonitoringSubscription -> Bool
$c/= :: DeleteMonitoringSubscription
-> DeleteMonitoringSubscription -> Bool
== :: DeleteMonitoringSubscription
-> DeleteMonitoringSubscription -> Bool
$c== :: DeleteMonitoringSubscription
-> DeleteMonitoringSubscription -> Bool
Prelude.Eq, ReadPrec [DeleteMonitoringSubscription]
ReadPrec DeleteMonitoringSubscription
Int -> ReadS DeleteMonitoringSubscription
ReadS [DeleteMonitoringSubscription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMonitoringSubscription]
$creadListPrec :: ReadPrec [DeleteMonitoringSubscription]
readPrec :: ReadPrec DeleteMonitoringSubscription
$creadPrec :: ReadPrec DeleteMonitoringSubscription
readList :: ReadS [DeleteMonitoringSubscription]
$creadList :: ReadS [DeleteMonitoringSubscription]
readsPrec :: Int -> ReadS DeleteMonitoringSubscription
$creadsPrec :: Int -> ReadS DeleteMonitoringSubscription
Prelude.Read, Int -> DeleteMonitoringSubscription -> ShowS
[DeleteMonitoringSubscription] -> ShowS
DeleteMonitoringSubscription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMonitoringSubscription] -> ShowS
$cshowList :: [DeleteMonitoringSubscription] -> ShowS
show :: DeleteMonitoringSubscription -> String
$cshow :: DeleteMonitoringSubscription -> String
showsPrec :: Int -> DeleteMonitoringSubscription -> ShowS
$cshowsPrec :: Int -> DeleteMonitoringSubscription -> ShowS
Prelude.Show, forall x.
Rep DeleteMonitoringSubscription x -> DeleteMonitoringSubscription
forall x.
DeleteMonitoringSubscription -> Rep DeleteMonitoringSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteMonitoringSubscription x -> DeleteMonitoringSubscription
$cfrom :: forall x.
DeleteMonitoringSubscription -> Rep DeleteMonitoringSubscription x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMonitoringSubscription' 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:
--
-- 'distributionId', 'deleteMonitoringSubscription_distributionId' - The ID of the distribution that you are disabling metrics for.
newDeleteMonitoringSubscription ::
  -- | 'distributionId'
  Prelude.Text ->
  DeleteMonitoringSubscription
newDeleteMonitoringSubscription :: Text -> DeleteMonitoringSubscription
newDeleteMonitoringSubscription Text
pDistributionId_ =
  DeleteMonitoringSubscription'
    { $sel:distributionId:DeleteMonitoringSubscription' :: Text
distributionId =
        Text
pDistributionId_
    }

-- | The ID of the distribution that you are disabling metrics for.
deleteMonitoringSubscription_distributionId :: Lens.Lens' DeleteMonitoringSubscription Prelude.Text
deleteMonitoringSubscription_distributionId :: Lens' DeleteMonitoringSubscription Text
deleteMonitoringSubscription_distributionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMonitoringSubscription' {Text
distributionId :: Text
$sel:distributionId:DeleteMonitoringSubscription' :: DeleteMonitoringSubscription -> Text
distributionId} -> Text
distributionId) (\s :: DeleteMonitoringSubscription
s@DeleteMonitoringSubscription' {} Text
a -> DeleteMonitoringSubscription
s {$sel:distributionId:DeleteMonitoringSubscription' :: Text
distributionId = Text
a} :: DeleteMonitoringSubscription)

instance Core.AWSRequest DeleteMonitoringSubscription where
  type
    AWSResponse DeleteMonitoringSubscription =
      DeleteMonitoringSubscriptionResponse
  request :: (Service -> Service)
-> DeleteMonitoringSubscription
-> Request DeleteMonitoringSubscription
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteMonitoringSubscription
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMonitoringSubscription)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteMonitoringSubscriptionResponse
DeleteMonitoringSubscriptionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

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

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

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

instance Data.ToPath DeleteMonitoringSubscription where
  toPath :: DeleteMonitoringSubscription -> ByteString
toPath DeleteMonitoringSubscription' {Text
distributionId :: Text
$sel:distributionId:DeleteMonitoringSubscription' :: DeleteMonitoringSubscription -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-05-31/distributions/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
distributionId,
        ByteString
"/monitoring-subscription/"
      ]

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

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

-- |
-- Create a value of 'DeleteMonitoringSubscriptionResponse' 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:
--
-- 'httpStatus', 'deleteMonitoringSubscriptionResponse_httpStatus' - The response's http status code.
newDeleteMonitoringSubscriptionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteMonitoringSubscriptionResponse
newDeleteMonitoringSubscriptionResponse :: Int -> DeleteMonitoringSubscriptionResponse
newDeleteMonitoringSubscriptionResponse Int
pHttpStatus_ =
  DeleteMonitoringSubscriptionResponse'
    { $sel:httpStatus:DeleteMonitoringSubscriptionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteMonitoringSubscriptionResponse_httpStatus :: Lens.Lens' DeleteMonitoringSubscriptionResponse Prelude.Int
deleteMonitoringSubscriptionResponse_httpStatus :: Lens' DeleteMonitoringSubscriptionResponse Int
deleteMonitoringSubscriptionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMonitoringSubscriptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteMonitoringSubscriptionResponse' :: DeleteMonitoringSubscriptionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteMonitoringSubscriptionResponse
s@DeleteMonitoringSubscriptionResponse' {} Int
a -> DeleteMonitoringSubscriptionResponse
s {$sel:httpStatus:DeleteMonitoringSubscriptionResponse' :: Int
httpStatus = Int
a} :: DeleteMonitoringSubscriptionResponse)

instance
  Prelude.NFData
    DeleteMonitoringSubscriptionResponse
  where
  rnf :: DeleteMonitoringSubscriptionResponse -> ()
rnf DeleteMonitoringSubscriptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteMonitoringSubscriptionResponse' :: DeleteMonitoringSubscriptionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus