{-# 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.FMS.GetNotificationChannel
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Information about the Amazon Simple Notification Service (SNS) topic
-- that is used to record Firewall Manager SNS logs.
module Amazonka.FMS.GetNotificationChannel
  ( -- * Creating a Request
    GetNotificationChannel (..),
    newGetNotificationChannel,

    -- * Destructuring the Response
    GetNotificationChannelResponse (..),
    newGetNotificationChannelResponse,

    -- * Response Lenses
    getNotificationChannelResponse_snsRoleName,
    getNotificationChannelResponse_snsTopicArn,
    getNotificationChannelResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FMS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

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

instance Core.AWSRequest GetNotificationChannel where
  type
    AWSResponse GetNotificationChannel =
      GetNotificationChannelResponse
  request :: (Service -> Service)
-> GetNotificationChannel -> Request GetNotificationChannel
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 GetNotificationChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetNotificationChannel)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> GetNotificationChannelResponse
GetNotificationChannelResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SnsRoleName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SnsTopicArn")
            forall (f :: * -> *) a b. Applicative f => 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 GetNotificationChannel where
  hashWithSalt :: Int -> GetNotificationChannel -> Int
hashWithSalt Int
_salt GetNotificationChannel
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

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

instance Data.ToHeaders GetNotificationChannel where
  toHeaders :: GetNotificationChannel -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"AWSFMS_20180101.GetNotificationChannel" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetNotificationChannel where
  toJSON :: GetNotificationChannel -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newGetNotificationChannelResponse' smart constructor.
data GetNotificationChannelResponse = GetNotificationChannelResponse'
  { -- | The IAM role that is used by Firewall Manager to record activity to SNS.
    GetNotificationChannelResponse -> Maybe Text
snsRoleName :: Prelude.Maybe Prelude.Text,
    -- | The SNS topic that records Firewall Manager activity.
    GetNotificationChannelResponse -> Maybe Text
snsTopicArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetNotificationChannelResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetNotificationChannelResponse
-> GetNotificationChannelResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNotificationChannelResponse
-> GetNotificationChannelResponse -> Bool
$c/= :: GetNotificationChannelResponse
-> GetNotificationChannelResponse -> Bool
== :: GetNotificationChannelResponse
-> GetNotificationChannelResponse -> Bool
$c== :: GetNotificationChannelResponse
-> GetNotificationChannelResponse -> Bool
Prelude.Eq, ReadPrec [GetNotificationChannelResponse]
ReadPrec GetNotificationChannelResponse
Int -> ReadS GetNotificationChannelResponse
ReadS [GetNotificationChannelResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNotificationChannelResponse]
$creadListPrec :: ReadPrec [GetNotificationChannelResponse]
readPrec :: ReadPrec GetNotificationChannelResponse
$creadPrec :: ReadPrec GetNotificationChannelResponse
readList :: ReadS [GetNotificationChannelResponse]
$creadList :: ReadS [GetNotificationChannelResponse]
readsPrec :: Int -> ReadS GetNotificationChannelResponse
$creadsPrec :: Int -> ReadS GetNotificationChannelResponse
Prelude.Read, Int -> GetNotificationChannelResponse -> ShowS
[GetNotificationChannelResponse] -> ShowS
GetNotificationChannelResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNotificationChannelResponse] -> ShowS
$cshowList :: [GetNotificationChannelResponse] -> ShowS
show :: GetNotificationChannelResponse -> String
$cshow :: GetNotificationChannelResponse -> String
showsPrec :: Int -> GetNotificationChannelResponse -> ShowS
$cshowsPrec :: Int -> GetNotificationChannelResponse -> ShowS
Prelude.Show, forall x.
Rep GetNotificationChannelResponse x
-> GetNotificationChannelResponse
forall x.
GetNotificationChannelResponse
-> Rep GetNotificationChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetNotificationChannelResponse x
-> GetNotificationChannelResponse
$cfrom :: forall x.
GetNotificationChannelResponse
-> Rep GetNotificationChannelResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetNotificationChannelResponse' 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:
--
-- 'snsRoleName', 'getNotificationChannelResponse_snsRoleName' - The IAM role that is used by Firewall Manager to record activity to SNS.
--
-- 'snsTopicArn', 'getNotificationChannelResponse_snsTopicArn' - The SNS topic that records Firewall Manager activity.
--
-- 'httpStatus', 'getNotificationChannelResponse_httpStatus' - The response's http status code.
newGetNotificationChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetNotificationChannelResponse
newGetNotificationChannelResponse :: Int -> GetNotificationChannelResponse
newGetNotificationChannelResponse Int
pHttpStatus_ =
  GetNotificationChannelResponse'
    { $sel:snsRoleName:GetNotificationChannelResponse' :: Maybe Text
snsRoleName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicArn:GetNotificationChannelResponse' :: Maybe Text
snsTopicArn = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetNotificationChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The IAM role that is used by Firewall Manager to record activity to SNS.
getNotificationChannelResponse_snsRoleName :: Lens.Lens' GetNotificationChannelResponse (Prelude.Maybe Prelude.Text)
getNotificationChannelResponse_snsRoleName :: Lens' GetNotificationChannelResponse (Maybe Text)
getNotificationChannelResponse_snsRoleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNotificationChannelResponse' {Maybe Text
snsRoleName :: Maybe Text
$sel:snsRoleName:GetNotificationChannelResponse' :: GetNotificationChannelResponse -> Maybe Text
snsRoleName} -> Maybe Text
snsRoleName) (\s :: GetNotificationChannelResponse
s@GetNotificationChannelResponse' {} Maybe Text
a -> GetNotificationChannelResponse
s {$sel:snsRoleName:GetNotificationChannelResponse' :: Maybe Text
snsRoleName = Maybe Text
a} :: GetNotificationChannelResponse)

-- | The SNS topic that records Firewall Manager activity.
getNotificationChannelResponse_snsTopicArn :: Lens.Lens' GetNotificationChannelResponse (Prelude.Maybe Prelude.Text)
getNotificationChannelResponse_snsTopicArn :: Lens' GetNotificationChannelResponse (Maybe Text)
getNotificationChannelResponse_snsTopicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNotificationChannelResponse' {Maybe Text
snsTopicArn :: Maybe Text
$sel:snsTopicArn:GetNotificationChannelResponse' :: GetNotificationChannelResponse -> Maybe Text
snsTopicArn} -> Maybe Text
snsTopicArn) (\s :: GetNotificationChannelResponse
s@GetNotificationChannelResponse' {} Maybe Text
a -> GetNotificationChannelResponse
s {$sel:snsTopicArn:GetNotificationChannelResponse' :: Maybe Text
snsTopicArn = Maybe Text
a} :: GetNotificationChannelResponse)

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

instance
  Prelude.NFData
    GetNotificationChannelResponse
  where
  rnf :: GetNotificationChannelResponse -> ()
rnf GetNotificationChannelResponse' {Int
Maybe Text
httpStatus :: Int
snsTopicArn :: Maybe Text
snsRoleName :: Maybe Text
$sel:httpStatus:GetNotificationChannelResponse' :: GetNotificationChannelResponse -> Int
$sel:snsTopicArn:GetNotificationChannelResponse' :: GetNotificationChannelResponse -> Maybe Text
$sel:snsRoleName:GetNotificationChannelResponse' :: GetNotificationChannelResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snsRoleName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snsTopicArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus