{-# 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.KinesisVideo.DescribeNotificationConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the @NotificationConfiguration@ for a given Kinesis video stream.
module Amazonka.KinesisVideo.DescribeNotificationConfiguration
  ( -- * Creating a Request
    DescribeNotificationConfiguration (..),
    newDescribeNotificationConfiguration,

    -- * Request Lenses
    describeNotificationConfiguration_streamARN,
    describeNotificationConfiguration_streamName,

    -- * Destructuring the Response
    DescribeNotificationConfigurationResponse (..),
    newDescribeNotificationConfigurationResponse,

    -- * Response Lenses
    describeNotificationConfigurationResponse_notificationConfiguration,
    describeNotificationConfigurationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeNotificationConfiguration' smart constructor.
data DescribeNotificationConfiguration = DescribeNotificationConfiguration'
  { -- | The Amazon Resource Name (ARN) of the Kinesis video stream from where
    -- you want to retrieve the notification configuration. You must specify
    -- either the @StreamName@ or the StreamARN.
    DescribeNotificationConfiguration -> Maybe Text
streamARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the stream from which to retrieve the notification
    -- configuration. You must specify either the @StreamName@ or the
    -- @StreamARN@.
    DescribeNotificationConfiguration -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeNotificationConfiguration
-> DescribeNotificationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeNotificationConfiguration
-> DescribeNotificationConfiguration -> Bool
$c/= :: DescribeNotificationConfiguration
-> DescribeNotificationConfiguration -> Bool
== :: DescribeNotificationConfiguration
-> DescribeNotificationConfiguration -> Bool
$c== :: DescribeNotificationConfiguration
-> DescribeNotificationConfiguration -> Bool
Prelude.Eq, ReadPrec [DescribeNotificationConfiguration]
ReadPrec DescribeNotificationConfiguration
Int -> ReadS DescribeNotificationConfiguration
ReadS [DescribeNotificationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeNotificationConfiguration]
$creadListPrec :: ReadPrec [DescribeNotificationConfiguration]
readPrec :: ReadPrec DescribeNotificationConfiguration
$creadPrec :: ReadPrec DescribeNotificationConfiguration
readList :: ReadS [DescribeNotificationConfiguration]
$creadList :: ReadS [DescribeNotificationConfiguration]
readsPrec :: Int -> ReadS DescribeNotificationConfiguration
$creadsPrec :: Int -> ReadS DescribeNotificationConfiguration
Prelude.Read, Int -> DescribeNotificationConfiguration -> ShowS
[DescribeNotificationConfiguration] -> ShowS
DescribeNotificationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeNotificationConfiguration] -> ShowS
$cshowList :: [DescribeNotificationConfiguration] -> ShowS
show :: DescribeNotificationConfiguration -> String
$cshow :: DescribeNotificationConfiguration -> String
showsPrec :: Int -> DescribeNotificationConfiguration -> ShowS
$cshowsPrec :: Int -> DescribeNotificationConfiguration -> ShowS
Prelude.Show, forall x.
Rep DescribeNotificationConfiguration x
-> DescribeNotificationConfiguration
forall x.
DescribeNotificationConfiguration
-> Rep DescribeNotificationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeNotificationConfiguration x
-> DescribeNotificationConfiguration
$cfrom :: forall x.
DescribeNotificationConfiguration
-> Rep DescribeNotificationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DescribeNotificationConfiguration' 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:
--
-- 'streamARN', 'describeNotificationConfiguration_streamARN' - The Amazon Resource Name (ARN) of the Kinesis video stream from where
-- you want to retrieve the notification configuration. You must specify
-- either the @StreamName@ or the StreamARN.
--
-- 'streamName', 'describeNotificationConfiguration_streamName' - The name of the stream from which to retrieve the notification
-- configuration. You must specify either the @StreamName@ or the
-- @StreamARN@.
newDescribeNotificationConfiguration ::
  DescribeNotificationConfiguration
newDescribeNotificationConfiguration :: DescribeNotificationConfiguration
newDescribeNotificationConfiguration =
  DescribeNotificationConfiguration'
    { $sel:streamARN:DescribeNotificationConfiguration' :: Maybe Text
streamARN =
        forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:DescribeNotificationConfiguration' :: Maybe Text
streamName = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the Kinesis video stream from where
-- you want to retrieve the notification configuration. You must specify
-- either the @StreamName@ or the StreamARN.
describeNotificationConfiguration_streamARN :: Lens.Lens' DescribeNotificationConfiguration (Prelude.Maybe Prelude.Text)
describeNotificationConfiguration_streamARN :: Lens' DescribeNotificationConfiguration (Maybe Text)
describeNotificationConfiguration_streamARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationConfiguration' {Maybe Text
streamARN :: Maybe Text
$sel:streamARN:DescribeNotificationConfiguration' :: DescribeNotificationConfiguration -> Maybe Text
streamARN} -> Maybe Text
streamARN) (\s :: DescribeNotificationConfiguration
s@DescribeNotificationConfiguration' {} Maybe Text
a -> DescribeNotificationConfiguration
s {$sel:streamARN:DescribeNotificationConfiguration' :: Maybe Text
streamARN = Maybe Text
a} :: DescribeNotificationConfiguration)

-- | The name of the stream from which to retrieve the notification
-- configuration. You must specify either the @StreamName@ or the
-- @StreamARN@.
describeNotificationConfiguration_streamName :: Lens.Lens' DescribeNotificationConfiguration (Prelude.Maybe Prelude.Text)
describeNotificationConfiguration_streamName :: Lens' DescribeNotificationConfiguration (Maybe Text)
describeNotificationConfiguration_streamName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationConfiguration' {Maybe Text
streamName :: Maybe Text
$sel:streamName:DescribeNotificationConfiguration' :: DescribeNotificationConfiguration -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: DescribeNotificationConfiguration
s@DescribeNotificationConfiguration' {} Maybe Text
a -> DescribeNotificationConfiguration
s {$sel:streamName:DescribeNotificationConfiguration' :: Maybe Text
streamName = Maybe Text
a} :: DescribeNotificationConfiguration)

instance
  Core.AWSRequest
    DescribeNotificationConfiguration
  where
  type
    AWSResponse DescribeNotificationConfiguration =
      DescribeNotificationConfigurationResponse
  request :: (Service -> Service)
-> DescribeNotificationConfiguration
-> Request DescribeNotificationConfiguration
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 DescribeNotificationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeNotificationConfiguration)))
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 NotificationConfiguration
-> Int -> DescribeNotificationConfigurationResponse
DescribeNotificationConfigurationResponse'
            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
"NotificationConfiguration")
            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
    DescribeNotificationConfiguration
  where
  hashWithSalt :: Int -> DescribeNotificationConfiguration -> Int
hashWithSalt
    Int
_salt
    DescribeNotificationConfiguration' {Maybe Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:streamName:DescribeNotificationConfiguration' :: DescribeNotificationConfiguration -> Maybe Text
$sel:streamARN:DescribeNotificationConfiguration' :: DescribeNotificationConfiguration -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamARN
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamName

instance
  Prelude.NFData
    DescribeNotificationConfiguration
  where
  rnf :: DescribeNotificationConfiguration -> ()
rnf DescribeNotificationConfiguration' {Maybe Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:streamName:DescribeNotificationConfiguration' :: DescribeNotificationConfiguration -> Maybe Text
$sel:streamARN:DescribeNotificationConfiguration' :: DescribeNotificationConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamName

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

instance
  Data.ToJSON
    DescribeNotificationConfiguration
  where
  toJSON :: DescribeNotificationConfiguration -> Value
toJSON DescribeNotificationConfiguration' {Maybe Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:streamName:DescribeNotificationConfiguration' :: DescribeNotificationConfiguration -> Maybe Text
$sel:streamARN:DescribeNotificationConfiguration' :: DescribeNotificationConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"StreamARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamARN,
            (Key
"StreamName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamName
          ]
      )

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

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

-- | /See:/ 'newDescribeNotificationConfigurationResponse' smart constructor.
data DescribeNotificationConfigurationResponse = DescribeNotificationConfigurationResponse'
  { -- | The structure that contains the information required for notifications.
    -- If the structure is null, the configuration will be deleted from the
    -- stream.
    DescribeNotificationConfigurationResponse
-> Maybe NotificationConfiguration
notificationConfiguration :: Prelude.Maybe NotificationConfiguration,
    -- | The response's http status code.
    DescribeNotificationConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeNotificationConfigurationResponse
-> DescribeNotificationConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeNotificationConfigurationResponse
-> DescribeNotificationConfigurationResponse -> Bool
$c/= :: DescribeNotificationConfigurationResponse
-> DescribeNotificationConfigurationResponse -> Bool
== :: DescribeNotificationConfigurationResponse
-> DescribeNotificationConfigurationResponse -> Bool
$c== :: DescribeNotificationConfigurationResponse
-> DescribeNotificationConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [DescribeNotificationConfigurationResponse]
ReadPrec DescribeNotificationConfigurationResponse
Int -> ReadS DescribeNotificationConfigurationResponse
ReadS [DescribeNotificationConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeNotificationConfigurationResponse]
$creadListPrec :: ReadPrec [DescribeNotificationConfigurationResponse]
readPrec :: ReadPrec DescribeNotificationConfigurationResponse
$creadPrec :: ReadPrec DescribeNotificationConfigurationResponse
readList :: ReadS [DescribeNotificationConfigurationResponse]
$creadList :: ReadS [DescribeNotificationConfigurationResponse]
readsPrec :: Int -> ReadS DescribeNotificationConfigurationResponse
$creadsPrec :: Int -> ReadS DescribeNotificationConfigurationResponse
Prelude.Read, Int -> DescribeNotificationConfigurationResponse -> ShowS
[DescribeNotificationConfigurationResponse] -> ShowS
DescribeNotificationConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeNotificationConfigurationResponse] -> ShowS
$cshowList :: [DescribeNotificationConfigurationResponse] -> ShowS
show :: DescribeNotificationConfigurationResponse -> String
$cshow :: DescribeNotificationConfigurationResponse -> String
showsPrec :: Int -> DescribeNotificationConfigurationResponse -> ShowS
$cshowsPrec :: Int -> DescribeNotificationConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeNotificationConfigurationResponse x
-> DescribeNotificationConfigurationResponse
forall x.
DescribeNotificationConfigurationResponse
-> Rep DescribeNotificationConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeNotificationConfigurationResponse x
-> DescribeNotificationConfigurationResponse
$cfrom :: forall x.
DescribeNotificationConfigurationResponse
-> Rep DescribeNotificationConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeNotificationConfigurationResponse' 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', 'describeNotificationConfigurationResponse_notificationConfiguration' - The structure that contains the information required for notifications.
-- If the structure is null, the configuration will be deleted from the
-- stream.
--
-- 'httpStatus', 'describeNotificationConfigurationResponse_httpStatus' - The response's http status code.
newDescribeNotificationConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeNotificationConfigurationResponse
newDescribeNotificationConfigurationResponse :: Int -> DescribeNotificationConfigurationResponse
newDescribeNotificationConfigurationResponse
  Int
pHttpStatus_ =
    DescribeNotificationConfigurationResponse'
      { $sel:notificationConfiguration:DescribeNotificationConfigurationResponse' :: Maybe NotificationConfiguration
notificationConfiguration =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeNotificationConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The structure that contains the information required for notifications.
-- If the structure is null, the configuration will be deleted from the
-- stream.
describeNotificationConfigurationResponse_notificationConfiguration :: Lens.Lens' DescribeNotificationConfigurationResponse (Prelude.Maybe NotificationConfiguration)
describeNotificationConfigurationResponse_notificationConfiguration :: Lens'
  DescribeNotificationConfigurationResponse
  (Maybe NotificationConfiguration)
describeNotificationConfigurationResponse_notificationConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNotificationConfigurationResponse' {Maybe NotificationConfiguration
notificationConfiguration :: Maybe NotificationConfiguration
$sel:notificationConfiguration:DescribeNotificationConfigurationResponse' :: DescribeNotificationConfigurationResponse
-> Maybe NotificationConfiguration
notificationConfiguration} -> Maybe NotificationConfiguration
notificationConfiguration) (\s :: DescribeNotificationConfigurationResponse
s@DescribeNotificationConfigurationResponse' {} Maybe NotificationConfiguration
a -> DescribeNotificationConfigurationResponse
s {$sel:notificationConfiguration:DescribeNotificationConfigurationResponse' :: Maybe NotificationConfiguration
notificationConfiguration = Maybe NotificationConfiguration
a} :: DescribeNotificationConfigurationResponse)

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

instance
  Prelude.NFData
    DescribeNotificationConfigurationResponse
  where
  rnf :: DescribeNotificationConfigurationResponse -> ()
rnf DescribeNotificationConfigurationResponse' {Int
Maybe NotificationConfiguration
httpStatus :: Int
notificationConfiguration :: Maybe NotificationConfiguration
$sel:httpStatus:DescribeNotificationConfigurationResponse' :: DescribeNotificationConfigurationResponse -> Int
$sel:notificationConfiguration:DescribeNotificationConfigurationResponse' :: DescribeNotificationConfigurationResponse
-> Maybe NotificationConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NotificationConfiguration
notificationConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus