{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteMonitoringSubscription
 -> DeleteMonitoringSubscription -> Bool)
-> (DeleteMonitoringSubscription
    -> DeleteMonitoringSubscription -> Bool)
-> Eq DeleteMonitoringSubscription
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]
(Int -> ReadS DeleteMonitoringSubscription)
-> ReadS [DeleteMonitoringSubscription]
-> ReadPrec DeleteMonitoringSubscription
-> ReadPrec [DeleteMonitoringSubscription]
-> Read 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
(Int -> DeleteMonitoringSubscription -> ShowS)
-> (DeleteMonitoringSubscription -> String)
-> ([DeleteMonitoringSubscription] -> ShowS)
-> Show DeleteMonitoringSubscription
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.
 DeleteMonitoringSubscription -> Rep DeleteMonitoringSubscription x)
-> (forall x.
    Rep DeleteMonitoringSubscription x -> DeleteMonitoringSubscription)
-> Generic DeleteMonitoringSubscription
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' :: Text -> DeleteMonitoringSubscription
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 :: (Text -> f Text)
-> DeleteMonitoringSubscription -> f DeleteMonitoringSubscription
deleteMonitoringSubscription_distributionId = (DeleteMonitoringSubscription -> Text)
-> (DeleteMonitoringSubscription
    -> Text -> DeleteMonitoringSubscription)
-> Lens
     DeleteMonitoringSubscription DeleteMonitoringSubscription Text Text
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 :: DeleteMonitoringSubscription
-> Request DeleteMonitoringSubscription
request = Service
-> DeleteMonitoringSubscription
-> Request DeleteMonitoringSubscription
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteMonitoringSubscription
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMonitoringSubscription)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteMonitoringSubscription))
-> Logger
-> Service
-> Proxy DeleteMonitoringSubscription
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMonitoringSubscription)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteMonitoringSubscriptionResponse
DeleteMonitoringSubscriptionResponse'
            (Int -> DeleteMonitoringSubscriptionResponse)
-> Either String Int
-> Either String DeleteMonitoringSubscriptionResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    DeleteMonitoringSubscription

instance Prelude.NFData DeleteMonitoringSubscription

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

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

instance Core.ToQuery DeleteMonitoringSubscription where
  toQuery :: DeleteMonitoringSubscription -> QueryString
toQuery = QueryString -> DeleteMonitoringSubscription -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteMonitoringSubscriptionResponse
 -> DeleteMonitoringSubscriptionResponse -> Bool)
-> (DeleteMonitoringSubscriptionResponse
    -> DeleteMonitoringSubscriptionResponse -> Bool)
-> Eq DeleteMonitoringSubscriptionResponse
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]
(Int -> ReadS DeleteMonitoringSubscriptionResponse)
-> ReadS [DeleteMonitoringSubscriptionResponse]
-> ReadPrec DeleteMonitoringSubscriptionResponse
-> ReadPrec [DeleteMonitoringSubscriptionResponse]
-> Read 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
(Int -> DeleteMonitoringSubscriptionResponse -> ShowS)
-> (DeleteMonitoringSubscriptionResponse -> String)
-> ([DeleteMonitoringSubscriptionResponse] -> ShowS)
-> Show DeleteMonitoringSubscriptionResponse
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.
 DeleteMonitoringSubscriptionResponse
 -> Rep DeleteMonitoringSubscriptionResponse x)
-> (forall x.
    Rep DeleteMonitoringSubscriptionResponse x
    -> DeleteMonitoringSubscriptionResponse)
-> Generic DeleteMonitoringSubscriptionResponse
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' :: Int -> DeleteMonitoringSubscriptionResponse
DeleteMonitoringSubscriptionResponse'
    { $sel:httpStatus:DeleteMonitoringSubscriptionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteMonitoringSubscriptionResponse_httpStatus :: Lens.Lens' DeleteMonitoringSubscriptionResponse Prelude.Int
deleteMonitoringSubscriptionResponse_httpStatus :: (Int -> f Int)
-> DeleteMonitoringSubscriptionResponse
-> f DeleteMonitoringSubscriptionResponse
deleteMonitoringSubscriptionResponse_httpStatus = (DeleteMonitoringSubscriptionResponse -> Int)
-> (DeleteMonitoringSubscriptionResponse
    -> Int -> DeleteMonitoringSubscriptionResponse)
-> Lens
     DeleteMonitoringSubscriptionResponse
     DeleteMonitoringSubscriptionResponse
     Int
     Int
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