{-# 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.CodeGuruProfiler.RemoveNotificationChannel
-- 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)
--
-- Remove one anomaly notifications channel for a profiling group.
module Amazonka.CodeGuruProfiler.RemoveNotificationChannel
  ( -- * Creating a Request
    RemoveNotificationChannel (..),
    newRemoveNotificationChannel,

    -- * Request Lenses
    removeNotificationChannel_channelId,
    removeNotificationChannel_profilingGroupName,

    -- * Destructuring the Response
    RemoveNotificationChannelResponse (..),
    newRemoveNotificationChannelResponse,

    -- * Response Lenses
    removeNotificationChannelResponse_notificationConfiguration,
    removeNotificationChannelResponse_httpStatus,
  )
where

import Amazonka.CodeGuruProfiler.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

-- | The structure representing the RemoveNotificationChannelRequest.
--
-- /See:/ 'newRemoveNotificationChannel' smart constructor.
data RemoveNotificationChannel = RemoveNotificationChannel'
  { -- | The id of the channel that we want to stop receiving notifications.
    RemoveNotificationChannel -> Text
channelId :: Prelude.Text,
    -- | The name of the profiling group we want to change notification
    -- configuration for.
    RemoveNotificationChannel -> Text
profilingGroupName :: Prelude.Text
  }
  deriving (RemoveNotificationChannel -> RemoveNotificationChannel -> Bool
(RemoveNotificationChannel -> RemoveNotificationChannel -> Bool)
-> (RemoveNotificationChannel -> RemoveNotificationChannel -> Bool)
-> Eq RemoveNotificationChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveNotificationChannel -> RemoveNotificationChannel -> Bool
$c/= :: RemoveNotificationChannel -> RemoveNotificationChannel -> Bool
== :: RemoveNotificationChannel -> RemoveNotificationChannel -> Bool
$c== :: RemoveNotificationChannel -> RemoveNotificationChannel -> Bool
Prelude.Eq, ReadPrec [RemoveNotificationChannel]
ReadPrec RemoveNotificationChannel
Int -> ReadS RemoveNotificationChannel
ReadS [RemoveNotificationChannel]
(Int -> ReadS RemoveNotificationChannel)
-> ReadS [RemoveNotificationChannel]
-> ReadPrec RemoveNotificationChannel
-> ReadPrec [RemoveNotificationChannel]
-> Read RemoveNotificationChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveNotificationChannel]
$creadListPrec :: ReadPrec [RemoveNotificationChannel]
readPrec :: ReadPrec RemoveNotificationChannel
$creadPrec :: ReadPrec RemoveNotificationChannel
readList :: ReadS [RemoveNotificationChannel]
$creadList :: ReadS [RemoveNotificationChannel]
readsPrec :: Int -> ReadS RemoveNotificationChannel
$creadsPrec :: Int -> ReadS RemoveNotificationChannel
Prelude.Read, Int -> RemoveNotificationChannel -> ShowS
[RemoveNotificationChannel] -> ShowS
RemoveNotificationChannel -> String
(Int -> RemoveNotificationChannel -> ShowS)
-> (RemoveNotificationChannel -> String)
-> ([RemoveNotificationChannel] -> ShowS)
-> Show RemoveNotificationChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveNotificationChannel] -> ShowS
$cshowList :: [RemoveNotificationChannel] -> ShowS
show :: RemoveNotificationChannel -> String
$cshow :: RemoveNotificationChannel -> String
showsPrec :: Int -> RemoveNotificationChannel -> ShowS
$cshowsPrec :: Int -> RemoveNotificationChannel -> ShowS
Prelude.Show, (forall x.
 RemoveNotificationChannel -> Rep RemoveNotificationChannel x)
-> (forall x.
    Rep RemoveNotificationChannel x -> RemoveNotificationChannel)
-> Generic RemoveNotificationChannel
forall x.
Rep RemoveNotificationChannel x -> RemoveNotificationChannel
forall x.
RemoveNotificationChannel -> Rep RemoveNotificationChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveNotificationChannel x -> RemoveNotificationChannel
$cfrom :: forall x.
RemoveNotificationChannel -> Rep RemoveNotificationChannel x
Prelude.Generic)

-- |
-- Create a value of 'RemoveNotificationChannel' 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:
--
-- 'channelId', 'removeNotificationChannel_channelId' - The id of the channel that we want to stop receiving notifications.
--
-- 'profilingGroupName', 'removeNotificationChannel_profilingGroupName' - The name of the profiling group we want to change notification
-- configuration for.
newRemoveNotificationChannel ::
  -- | 'channelId'
  Prelude.Text ->
  -- | 'profilingGroupName'
  Prelude.Text ->
  RemoveNotificationChannel
newRemoveNotificationChannel :: Text -> Text -> RemoveNotificationChannel
newRemoveNotificationChannel
  Text
pChannelId_
  Text
pProfilingGroupName_ =
    RemoveNotificationChannel' :: Text -> Text -> RemoveNotificationChannel
RemoveNotificationChannel'
      { $sel:channelId:RemoveNotificationChannel' :: Text
channelId = Text
pChannelId_,
        $sel:profilingGroupName:RemoveNotificationChannel' :: Text
profilingGroupName = Text
pProfilingGroupName_
      }

-- | The id of the channel that we want to stop receiving notifications.
removeNotificationChannel_channelId :: Lens.Lens' RemoveNotificationChannel Prelude.Text
removeNotificationChannel_channelId :: (Text -> f Text)
-> RemoveNotificationChannel -> f RemoveNotificationChannel
removeNotificationChannel_channelId = (RemoveNotificationChannel -> Text)
-> (RemoveNotificationChannel -> Text -> RemoveNotificationChannel)
-> Lens
     RemoveNotificationChannel RemoveNotificationChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveNotificationChannel' {Text
channelId :: Text
$sel:channelId:RemoveNotificationChannel' :: RemoveNotificationChannel -> Text
channelId} -> Text
channelId) (\s :: RemoveNotificationChannel
s@RemoveNotificationChannel' {} Text
a -> RemoveNotificationChannel
s {$sel:channelId:RemoveNotificationChannel' :: Text
channelId = Text
a} :: RemoveNotificationChannel)

-- | The name of the profiling group we want to change notification
-- configuration for.
removeNotificationChannel_profilingGroupName :: Lens.Lens' RemoveNotificationChannel Prelude.Text
removeNotificationChannel_profilingGroupName :: (Text -> f Text)
-> RemoveNotificationChannel -> f RemoveNotificationChannel
removeNotificationChannel_profilingGroupName = (RemoveNotificationChannel -> Text)
-> (RemoveNotificationChannel -> Text -> RemoveNotificationChannel)
-> Lens
     RemoveNotificationChannel RemoveNotificationChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveNotificationChannel' {Text
profilingGroupName :: Text
$sel:profilingGroupName:RemoveNotificationChannel' :: RemoveNotificationChannel -> Text
profilingGroupName} -> Text
profilingGroupName) (\s :: RemoveNotificationChannel
s@RemoveNotificationChannel' {} Text
a -> RemoveNotificationChannel
s {$sel:profilingGroupName:RemoveNotificationChannel' :: Text
profilingGroupName = Text
a} :: RemoveNotificationChannel)

instance Core.AWSRequest RemoveNotificationChannel where
  type
    AWSResponse RemoveNotificationChannel =
      RemoveNotificationChannelResponse
  request :: RemoveNotificationChannel -> Request RemoveNotificationChannel
request = Service
-> RemoveNotificationChannel -> Request RemoveNotificationChannel
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy RemoveNotificationChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveNotificationChannel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse RemoveNotificationChannel))
-> Logger
-> Service
-> Proxy RemoveNotificationChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveNotificationChannel)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe NotificationConfiguration
-> Int -> RemoveNotificationChannelResponse
RemoveNotificationChannelResponse'
            (Maybe NotificationConfiguration
 -> Int -> RemoveNotificationChannelResponse)
-> Either String (Maybe NotificationConfiguration)
-> Either String (Int -> RemoveNotificationChannelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe NotificationConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"notificationConfiguration")
            Either String (Int -> RemoveNotificationChannelResponse)
-> Either String Int
-> Either String RemoveNotificationChannelResponse
forall (f :: * -> *) a b. Applicative f => 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 RemoveNotificationChannel

instance Prelude.NFData RemoveNotificationChannel

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

instance Core.ToPath RemoveNotificationChannel where
  toPath :: RemoveNotificationChannel -> ByteString
toPath RemoveNotificationChannel' {Text
profilingGroupName :: Text
channelId :: Text
$sel:profilingGroupName:RemoveNotificationChannel' :: RemoveNotificationChannel -> Text
$sel:channelId:RemoveNotificationChannel' :: RemoveNotificationChannel -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/profilingGroups/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profilingGroupName,
        ByteString
"/notificationConfiguration/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelId
      ]

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

-- | The structure representing the RemoveNotificationChannelResponse.
--
-- /See:/ 'newRemoveNotificationChannelResponse' smart constructor.
data RemoveNotificationChannelResponse = RemoveNotificationChannelResponse'
  { -- | The new notification configuration for this profiling group.
    RemoveNotificationChannelResponse
-> Maybe NotificationConfiguration
notificationConfiguration :: Prelude.Maybe NotificationConfiguration,
    -- | The response's http status code.
    RemoveNotificationChannelResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RemoveNotificationChannelResponse
-> RemoveNotificationChannelResponse -> Bool
(RemoveNotificationChannelResponse
 -> RemoveNotificationChannelResponse -> Bool)
-> (RemoveNotificationChannelResponse
    -> RemoveNotificationChannelResponse -> Bool)
-> Eq RemoveNotificationChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveNotificationChannelResponse
-> RemoveNotificationChannelResponse -> Bool
$c/= :: RemoveNotificationChannelResponse
-> RemoveNotificationChannelResponse -> Bool
== :: RemoveNotificationChannelResponse
-> RemoveNotificationChannelResponse -> Bool
$c== :: RemoveNotificationChannelResponse
-> RemoveNotificationChannelResponse -> Bool
Prelude.Eq, ReadPrec [RemoveNotificationChannelResponse]
ReadPrec RemoveNotificationChannelResponse
Int -> ReadS RemoveNotificationChannelResponse
ReadS [RemoveNotificationChannelResponse]
(Int -> ReadS RemoveNotificationChannelResponse)
-> ReadS [RemoveNotificationChannelResponse]
-> ReadPrec RemoveNotificationChannelResponse
-> ReadPrec [RemoveNotificationChannelResponse]
-> Read RemoveNotificationChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveNotificationChannelResponse]
$creadListPrec :: ReadPrec [RemoveNotificationChannelResponse]
readPrec :: ReadPrec RemoveNotificationChannelResponse
$creadPrec :: ReadPrec RemoveNotificationChannelResponse
readList :: ReadS [RemoveNotificationChannelResponse]
$creadList :: ReadS [RemoveNotificationChannelResponse]
readsPrec :: Int -> ReadS RemoveNotificationChannelResponse
$creadsPrec :: Int -> ReadS RemoveNotificationChannelResponse
Prelude.Read, Int -> RemoveNotificationChannelResponse -> ShowS
[RemoveNotificationChannelResponse] -> ShowS
RemoveNotificationChannelResponse -> String
(Int -> RemoveNotificationChannelResponse -> ShowS)
-> (RemoveNotificationChannelResponse -> String)
-> ([RemoveNotificationChannelResponse] -> ShowS)
-> Show RemoveNotificationChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveNotificationChannelResponse] -> ShowS
$cshowList :: [RemoveNotificationChannelResponse] -> ShowS
show :: RemoveNotificationChannelResponse -> String
$cshow :: RemoveNotificationChannelResponse -> String
showsPrec :: Int -> RemoveNotificationChannelResponse -> ShowS
$cshowsPrec :: Int -> RemoveNotificationChannelResponse -> ShowS
Prelude.Show, (forall x.
 RemoveNotificationChannelResponse
 -> Rep RemoveNotificationChannelResponse x)
-> (forall x.
    Rep RemoveNotificationChannelResponse x
    -> RemoveNotificationChannelResponse)
-> Generic RemoveNotificationChannelResponse
forall x.
Rep RemoveNotificationChannelResponse x
-> RemoveNotificationChannelResponse
forall x.
RemoveNotificationChannelResponse
-> Rep RemoveNotificationChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveNotificationChannelResponse x
-> RemoveNotificationChannelResponse
$cfrom :: forall x.
RemoveNotificationChannelResponse
-> Rep RemoveNotificationChannelResponse x
Prelude.Generic)

-- |
-- Create a value of 'RemoveNotificationChannelResponse' 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:
--
-- 'notificationConfiguration', 'removeNotificationChannelResponse_notificationConfiguration' - The new notification configuration for this profiling group.
--
-- 'httpStatus', 'removeNotificationChannelResponse_httpStatus' - The response's http status code.
newRemoveNotificationChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RemoveNotificationChannelResponse
newRemoveNotificationChannelResponse :: Int -> RemoveNotificationChannelResponse
newRemoveNotificationChannelResponse Int
pHttpStatus_ =
  RemoveNotificationChannelResponse' :: Maybe NotificationConfiguration
-> Int -> RemoveNotificationChannelResponse
RemoveNotificationChannelResponse'
    { $sel:notificationConfiguration:RemoveNotificationChannelResponse' :: Maybe NotificationConfiguration
notificationConfiguration =
        Maybe NotificationConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RemoveNotificationChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The new notification configuration for this profiling group.
removeNotificationChannelResponse_notificationConfiguration :: Lens.Lens' RemoveNotificationChannelResponse (Prelude.Maybe NotificationConfiguration)
removeNotificationChannelResponse_notificationConfiguration :: (Maybe NotificationConfiguration
 -> f (Maybe NotificationConfiguration))
-> RemoveNotificationChannelResponse
-> f RemoveNotificationChannelResponse
removeNotificationChannelResponse_notificationConfiguration = (RemoveNotificationChannelResponse
 -> Maybe NotificationConfiguration)
-> (RemoveNotificationChannelResponse
    -> Maybe NotificationConfiguration
    -> RemoveNotificationChannelResponse)
-> Lens
     RemoveNotificationChannelResponse
     RemoveNotificationChannelResponse
     (Maybe NotificationConfiguration)
     (Maybe NotificationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveNotificationChannelResponse' {Maybe NotificationConfiguration
notificationConfiguration :: Maybe NotificationConfiguration
$sel:notificationConfiguration:RemoveNotificationChannelResponse' :: RemoveNotificationChannelResponse
-> Maybe NotificationConfiguration
notificationConfiguration} -> Maybe NotificationConfiguration
notificationConfiguration) (\s :: RemoveNotificationChannelResponse
s@RemoveNotificationChannelResponse' {} Maybe NotificationConfiguration
a -> RemoveNotificationChannelResponse
s {$sel:notificationConfiguration:RemoveNotificationChannelResponse' :: Maybe NotificationConfiguration
notificationConfiguration = Maybe NotificationConfiguration
a} :: RemoveNotificationChannelResponse)

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

instance
  Prelude.NFData
    RemoveNotificationChannelResponse