{-# 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-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)
--
-- 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_snsTopicArn,
    getNotificationChannelResponse_snsRoleName,
    getNotificationChannelResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.FMS.Types
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:/ 'newGetNotificationChannel' smart constructor.
data GetNotificationChannel = GetNotificationChannel'
  {
  }
  deriving (GetNotificationChannel -> GetNotificationChannel -> Bool
(GetNotificationChannel -> GetNotificationChannel -> Bool)
-> (GetNotificationChannel -> GetNotificationChannel -> Bool)
-> Eq GetNotificationChannel
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]
(Int -> ReadS GetNotificationChannel)
-> ReadS [GetNotificationChannel]
-> ReadPrec GetNotificationChannel
-> ReadPrec [GetNotificationChannel]
-> Read 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
(Int -> GetNotificationChannel -> ShowS)
-> (GetNotificationChannel -> String)
-> ([GetNotificationChannel] -> ShowS)
-> Show GetNotificationChannel
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. GetNotificationChannel -> Rep GetNotificationChannel x)
-> (forall x.
    Rep GetNotificationChannel x -> GetNotificationChannel)
-> Generic GetNotificationChannel
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 :: GetNotificationChannel -> Request GetNotificationChannel
request = Service -> GetNotificationChannel -> Request GetNotificationChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetNotificationChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetNotificationChannel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetNotificationChannel))
-> Logger
-> Service
-> Proxy GetNotificationChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetNotificationChannel)))
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 Text -> Maybe Text -> Int -> GetNotificationChannelResponse
GetNotificationChannelResponse'
            (Maybe Text -> Maybe Text -> Int -> GetNotificationChannelResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> GetNotificationChannelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SnsTopicArn")
            Either String (Maybe Text -> Int -> GetNotificationChannelResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetNotificationChannelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SnsRoleName")
            Either String (Int -> GetNotificationChannelResponse)
-> Either String Int
-> Either String GetNotificationChannelResponse
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 GetNotificationChannel

instance Prelude.NFData GetNotificationChannel

instance Core.ToHeaders GetNotificationChannel where
  toHeaders :: GetNotificationChannel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetNotificationChannel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSFMS_20180101.GetNotificationChannel" ::
                          Prelude.ByteString
                      ),
            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.ToJSON GetNotificationChannel where
  toJSON :: GetNotificationChannel -> Value
toJSON = Value -> GetNotificationChannel -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newGetNotificationChannelResponse' smart constructor.
data GetNotificationChannelResponse = GetNotificationChannelResponse'
  { -- | The SNS topic that records Firewall Manager activity.
    GetNotificationChannelResponse -> Maybe Text
snsTopicArn :: Prelude.Maybe Prelude.Text,
    -- | The IAM role that is used by Firewall Manager to record activity to SNS.
    GetNotificationChannelResponse -> Maybe Text
snsRoleName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetNotificationChannelResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetNotificationChannelResponse
-> GetNotificationChannelResponse -> Bool
(GetNotificationChannelResponse
 -> GetNotificationChannelResponse -> Bool)
-> (GetNotificationChannelResponse
    -> GetNotificationChannelResponse -> Bool)
-> Eq GetNotificationChannelResponse
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]
(Int -> ReadS GetNotificationChannelResponse)
-> ReadS [GetNotificationChannelResponse]
-> ReadPrec GetNotificationChannelResponse
-> ReadPrec [GetNotificationChannelResponse]
-> Read 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
(Int -> GetNotificationChannelResponse -> ShowS)
-> (GetNotificationChannelResponse -> String)
-> ([GetNotificationChannelResponse] -> ShowS)
-> Show GetNotificationChannelResponse
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.
 GetNotificationChannelResponse
 -> Rep GetNotificationChannelResponse x)
-> (forall x.
    Rep GetNotificationChannelResponse x
    -> GetNotificationChannelResponse)
-> Generic GetNotificationChannelResponse
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:
--
-- 'snsTopicArn', 'getNotificationChannelResponse_snsTopicArn' - The SNS topic that records Firewall Manager activity.
--
-- 'snsRoleName', 'getNotificationChannelResponse_snsRoleName' - The IAM role that is used by Firewall Manager to record activity to SNS.
--
-- 'httpStatus', 'getNotificationChannelResponse_httpStatus' - The response's http status code.
newGetNotificationChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetNotificationChannelResponse
newGetNotificationChannelResponse :: Int -> GetNotificationChannelResponse
newGetNotificationChannelResponse Int
pHttpStatus_ =
  GetNotificationChannelResponse' :: Maybe Text -> Maybe Text -> Int -> GetNotificationChannelResponse
GetNotificationChannelResponse'
    { $sel:snsTopicArn:GetNotificationChannelResponse' :: Maybe Text
snsTopicArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsRoleName:GetNotificationChannelResponse' :: Maybe Text
snsRoleName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetNotificationChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The SNS topic that records Firewall Manager activity.
getNotificationChannelResponse_snsTopicArn :: Lens.Lens' GetNotificationChannelResponse (Prelude.Maybe Prelude.Text)
getNotificationChannelResponse_snsTopicArn :: (Maybe Text -> f (Maybe Text))
-> GetNotificationChannelResponse
-> f GetNotificationChannelResponse
getNotificationChannelResponse_snsTopicArn = (GetNotificationChannelResponse -> Maybe Text)
-> (GetNotificationChannelResponse
    -> Maybe Text -> GetNotificationChannelResponse)
-> Lens
     GetNotificationChannelResponse
     GetNotificationChannelResponse
     (Maybe Text)
     (Maybe Text)
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 IAM role that is used by Firewall Manager to record activity to SNS.
getNotificationChannelResponse_snsRoleName :: Lens.Lens' GetNotificationChannelResponse (Prelude.Maybe Prelude.Text)
getNotificationChannelResponse_snsRoleName :: (Maybe Text -> f (Maybe Text))
-> GetNotificationChannelResponse
-> f GetNotificationChannelResponse
getNotificationChannelResponse_snsRoleName = (GetNotificationChannelResponse -> Maybe Text)
-> (GetNotificationChannelResponse
    -> Maybe Text -> GetNotificationChannelResponse)
-> Lens
     GetNotificationChannelResponse
     GetNotificationChannelResponse
     (Maybe Text)
     (Maybe Text)
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 response's http status code.
getNotificationChannelResponse_httpStatus :: Lens.Lens' GetNotificationChannelResponse Prelude.Int
getNotificationChannelResponse_httpStatus :: (Int -> f Int)
-> GetNotificationChannelResponse
-> f GetNotificationChannelResponse
getNotificationChannelResponse_httpStatus = (GetNotificationChannelResponse -> Int)
-> (GetNotificationChannelResponse
    -> Int -> GetNotificationChannelResponse)
-> Lens
     GetNotificationChannelResponse
     GetNotificationChannelResponse
     Int
     Int
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