{-# 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.Rum.DeleteRumMetricsDestination
-- 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 destination for CloudWatch RUM extended metrics, so that the
-- specified app monitor stops sending extended metrics to that
-- destination.
module Amazonka.Rum.DeleteRumMetricsDestination
  ( -- * Creating a Request
    DeleteRumMetricsDestination (..),
    newDeleteRumMetricsDestination,

    -- * Request Lenses
    deleteRumMetricsDestination_destinationArn,
    deleteRumMetricsDestination_appMonitorName,
    deleteRumMetricsDestination_destination,

    -- * Destructuring the Response
    DeleteRumMetricsDestinationResponse (..),
    newDeleteRumMetricsDestinationResponse,

    -- * Response Lenses
    deleteRumMetricsDestinationResponse_httpStatus,
  )
where

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
import Amazonka.Rum.Types

-- | /See:/ 'newDeleteRumMetricsDestination' smart constructor.
data DeleteRumMetricsDestination = DeleteRumMetricsDestination'
  { -- | This parameter is required if @Destination@ is @Evidently@. If
    -- @Destination@ is @CloudWatch@, do not use this parameter. This parameter
    -- specifies the ARN of the Evidently experiment that corresponds to the
    -- destination to delete.
    DeleteRumMetricsDestination -> Maybe Text
destinationArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the app monitor that is sending metrics to the destination
    -- that you want to delete.
    DeleteRumMetricsDestination -> Text
appMonitorName :: Prelude.Text,
    -- | The type of destination to delete. Valid values are @CloudWatch@ and
    -- @Evidently@.
    DeleteRumMetricsDestination -> MetricDestination
destination :: MetricDestination
  }
  deriving (DeleteRumMetricsDestination -> DeleteRumMetricsDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRumMetricsDestination -> DeleteRumMetricsDestination -> Bool
$c/= :: DeleteRumMetricsDestination -> DeleteRumMetricsDestination -> Bool
== :: DeleteRumMetricsDestination -> DeleteRumMetricsDestination -> Bool
$c== :: DeleteRumMetricsDestination -> DeleteRumMetricsDestination -> Bool
Prelude.Eq, ReadPrec [DeleteRumMetricsDestination]
ReadPrec DeleteRumMetricsDestination
Int -> ReadS DeleteRumMetricsDestination
ReadS [DeleteRumMetricsDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRumMetricsDestination]
$creadListPrec :: ReadPrec [DeleteRumMetricsDestination]
readPrec :: ReadPrec DeleteRumMetricsDestination
$creadPrec :: ReadPrec DeleteRumMetricsDestination
readList :: ReadS [DeleteRumMetricsDestination]
$creadList :: ReadS [DeleteRumMetricsDestination]
readsPrec :: Int -> ReadS DeleteRumMetricsDestination
$creadsPrec :: Int -> ReadS DeleteRumMetricsDestination
Prelude.Read, Int -> DeleteRumMetricsDestination -> ShowS
[DeleteRumMetricsDestination] -> ShowS
DeleteRumMetricsDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRumMetricsDestination] -> ShowS
$cshowList :: [DeleteRumMetricsDestination] -> ShowS
show :: DeleteRumMetricsDestination -> String
$cshow :: DeleteRumMetricsDestination -> String
showsPrec :: Int -> DeleteRumMetricsDestination -> ShowS
$cshowsPrec :: Int -> DeleteRumMetricsDestination -> ShowS
Prelude.Show, forall x.
Rep DeleteRumMetricsDestination x -> DeleteRumMetricsDestination
forall x.
DeleteRumMetricsDestination -> Rep DeleteRumMetricsDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteRumMetricsDestination x -> DeleteRumMetricsDestination
$cfrom :: forall x.
DeleteRumMetricsDestination -> Rep DeleteRumMetricsDestination x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRumMetricsDestination' 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:
--
-- 'destinationArn', 'deleteRumMetricsDestination_destinationArn' - This parameter is required if @Destination@ is @Evidently@. If
-- @Destination@ is @CloudWatch@, do not use this parameter. This parameter
-- specifies the ARN of the Evidently experiment that corresponds to the
-- destination to delete.
--
-- 'appMonitorName', 'deleteRumMetricsDestination_appMonitorName' - The name of the app monitor that is sending metrics to the destination
-- that you want to delete.
--
-- 'destination', 'deleteRumMetricsDestination_destination' - The type of destination to delete. Valid values are @CloudWatch@ and
-- @Evidently@.
newDeleteRumMetricsDestination ::
  -- | 'appMonitorName'
  Prelude.Text ->
  -- | 'destination'
  MetricDestination ->
  DeleteRumMetricsDestination
newDeleteRumMetricsDestination :: Text -> MetricDestination -> DeleteRumMetricsDestination
newDeleteRumMetricsDestination
  Text
pAppMonitorName_
  MetricDestination
pDestination_ =
    DeleteRumMetricsDestination'
      { $sel:destinationArn:DeleteRumMetricsDestination' :: Maybe Text
destinationArn =
          forall a. Maybe a
Prelude.Nothing,
        $sel:appMonitorName:DeleteRumMetricsDestination' :: Text
appMonitorName = Text
pAppMonitorName_,
        $sel:destination:DeleteRumMetricsDestination' :: MetricDestination
destination = MetricDestination
pDestination_
      }

-- | This parameter is required if @Destination@ is @Evidently@. If
-- @Destination@ is @CloudWatch@, do not use this parameter. This parameter
-- specifies the ARN of the Evidently experiment that corresponds to the
-- destination to delete.
deleteRumMetricsDestination_destinationArn :: Lens.Lens' DeleteRumMetricsDestination (Prelude.Maybe Prelude.Text)
deleteRumMetricsDestination_destinationArn :: Lens' DeleteRumMetricsDestination (Maybe Text)
deleteRumMetricsDestination_destinationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRumMetricsDestination' {Maybe Text
destinationArn :: Maybe Text
$sel:destinationArn:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Maybe Text
destinationArn} -> Maybe Text
destinationArn) (\s :: DeleteRumMetricsDestination
s@DeleteRumMetricsDestination' {} Maybe Text
a -> DeleteRumMetricsDestination
s {$sel:destinationArn:DeleteRumMetricsDestination' :: Maybe Text
destinationArn = Maybe Text
a} :: DeleteRumMetricsDestination)

-- | The name of the app monitor that is sending metrics to the destination
-- that you want to delete.
deleteRumMetricsDestination_appMonitorName :: Lens.Lens' DeleteRumMetricsDestination Prelude.Text
deleteRumMetricsDestination_appMonitorName :: Lens' DeleteRumMetricsDestination Text
deleteRumMetricsDestination_appMonitorName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRumMetricsDestination' {Text
appMonitorName :: Text
$sel:appMonitorName:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Text
appMonitorName} -> Text
appMonitorName) (\s :: DeleteRumMetricsDestination
s@DeleteRumMetricsDestination' {} Text
a -> DeleteRumMetricsDestination
s {$sel:appMonitorName:DeleteRumMetricsDestination' :: Text
appMonitorName = Text
a} :: DeleteRumMetricsDestination)

-- | The type of destination to delete. Valid values are @CloudWatch@ and
-- @Evidently@.
deleteRumMetricsDestination_destination :: Lens.Lens' DeleteRumMetricsDestination MetricDestination
deleteRumMetricsDestination_destination :: Lens' DeleteRumMetricsDestination MetricDestination
deleteRumMetricsDestination_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRumMetricsDestination' {MetricDestination
destination :: MetricDestination
$sel:destination:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> MetricDestination
destination} -> MetricDestination
destination) (\s :: DeleteRumMetricsDestination
s@DeleteRumMetricsDestination' {} MetricDestination
a -> DeleteRumMetricsDestination
s {$sel:destination:DeleteRumMetricsDestination' :: MetricDestination
destination = MetricDestination
a} :: DeleteRumMetricsDestination)

instance Core.AWSRequest DeleteRumMetricsDestination where
  type
    AWSResponse DeleteRumMetricsDestination =
      DeleteRumMetricsDestinationResponse
  request :: (Service -> Service)
-> DeleteRumMetricsDestination
-> Request DeleteRumMetricsDestination
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 DeleteRumMetricsDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRumMetricsDestination)))
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 -> DeleteRumMetricsDestinationResponse
DeleteRumMetricsDestinationResponse'
            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 DeleteRumMetricsDestination where
  hashWithSalt :: Int -> DeleteRumMetricsDestination -> Int
hashWithSalt Int
_salt DeleteRumMetricsDestination' {Maybe Text
Text
MetricDestination
destination :: MetricDestination
appMonitorName :: Text
destinationArn :: Maybe Text
$sel:destination:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> MetricDestination
$sel:appMonitorName:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Text
$sel:destinationArn:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appMonitorName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MetricDestination
destination

instance Prelude.NFData DeleteRumMetricsDestination where
  rnf :: DeleteRumMetricsDestination -> ()
rnf DeleteRumMetricsDestination' {Maybe Text
Text
MetricDestination
destination :: MetricDestination
appMonitorName :: Text
destinationArn :: Maybe Text
$sel:destination:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> MetricDestination
$sel:appMonitorName:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Text
$sel:destinationArn:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
appMonitorName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MetricDestination
destination

instance Data.ToHeaders DeleteRumMetricsDestination where
  toHeaders :: DeleteRumMetricsDestination -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteRumMetricsDestination where
  toPath :: DeleteRumMetricsDestination -> ByteString
toPath DeleteRumMetricsDestination' {Maybe Text
Text
MetricDestination
destination :: MetricDestination
appMonitorName :: Text
destinationArn :: Maybe Text
$sel:destination:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> MetricDestination
$sel:appMonitorName:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Text
$sel:destinationArn:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/rummetrics/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
appMonitorName,
        ByteString
"/metricsdestination"
      ]

instance Data.ToQuery DeleteRumMetricsDestination where
  toQuery :: DeleteRumMetricsDestination -> QueryString
toQuery DeleteRumMetricsDestination' {Maybe Text
Text
MetricDestination
destination :: MetricDestination
appMonitorName :: Text
destinationArn :: Maybe Text
$sel:destination:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> MetricDestination
$sel:appMonitorName:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Text
$sel:destinationArn:DeleteRumMetricsDestination' :: DeleteRumMetricsDestination -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"destinationArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
destinationArn,
        ByteString
"destination" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: MetricDestination
destination
      ]

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

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

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

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