{-# 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.UpdateNotificationConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the notification information for a stream.
module Amazonka.KinesisVideo.UpdateNotificationConfiguration
  ( -- * Creating a Request
    UpdateNotificationConfiguration (..),
    newUpdateNotificationConfiguration,

    -- * Request Lenses
    updateNotificationConfiguration_notificationConfiguration,
    updateNotificationConfiguration_streamARN,
    updateNotificationConfiguration_streamName,

    -- * Destructuring the Response
    UpdateNotificationConfigurationResponse (..),
    newUpdateNotificationConfigurationResponse,

    -- * Response Lenses
    updateNotificationConfigurationResponse_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:/ 'newUpdateNotificationConfiguration' smart constructor.
data UpdateNotificationConfiguration = UpdateNotificationConfiguration'
  { -- | The structure containing the information required for notifications. If
    -- the structure is null, the configuration will be deleted from the
    -- stream.
    UpdateNotificationConfiguration -> Maybe NotificationConfiguration
notificationConfiguration :: Prelude.Maybe NotificationConfiguration,
    -- | The Amazon Resource Name (ARN) of the Kinesis video stream from where
    -- you want to update the notification configuration. You must specify
    -- either the @StreamName@ or the @StreamARN@.
    UpdateNotificationConfiguration -> Maybe Text
streamARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the stream from which to update the notification
    -- configuration. You must specify either the @StreamName@ or the
    -- @StreamARN@.
    UpdateNotificationConfiguration -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateNotificationConfiguration
-> UpdateNotificationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNotificationConfiguration
-> UpdateNotificationConfiguration -> Bool
$c/= :: UpdateNotificationConfiguration
-> UpdateNotificationConfiguration -> Bool
== :: UpdateNotificationConfiguration
-> UpdateNotificationConfiguration -> Bool
$c== :: UpdateNotificationConfiguration
-> UpdateNotificationConfiguration -> Bool
Prelude.Eq, ReadPrec [UpdateNotificationConfiguration]
ReadPrec UpdateNotificationConfiguration
Int -> ReadS UpdateNotificationConfiguration
ReadS [UpdateNotificationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNotificationConfiguration]
$creadListPrec :: ReadPrec [UpdateNotificationConfiguration]
readPrec :: ReadPrec UpdateNotificationConfiguration
$creadPrec :: ReadPrec UpdateNotificationConfiguration
readList :: ReadS [UpdateNotificationConfiguration]
$creadList :: ReadS [UpdateNotificationConfiguration]
readsPrec :: Int -> ReadS UpdateNotificationConfiguration
$creadsPrec :: Int -> ReadS UpdateNotificationConfiguration
Prelude.Read, Int -> UpdateNotificationConfiguration -> ShowS
[UpdateNotificationConfiguration] -> ShowS
UpdateNotificationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNotificationConfiguration] -> ShowS
$cshowList :: [UpdateNotificationConfiguration] -> ShowS
show :: UpdateNotificationConfiguration -> String
$cshow :: UpdateNotificationConfiguration -> String
showsPrec :: Int -> UpdateNotificationConfiguration -> ShowS
$cshowsPrec :: Int -> UpdateNotificationConfiguration -> ShowS
Prelude.Show, forall x.
Rep UpdateNotificationConfiguration x
-> UpdateNotificationConfiguration
forall x.
UpdateNotificationConfiguration
-> Rep UpdateNotificationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateNotificationConfiguration x
-> UpdateNotificationConfiguration
$cfrom :: forall x.
UpdateNotificationConfiguration
-> Rep UpdateNotificationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'UpdateNotificationConfiguration' 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', 'updateNotificationConfiguration_notificationConfiguration' - The structure containing the information required for notifications. If
-- the structure is null, the configuration will be deleted from the
-- stream.
--
-- 'streamARN', 'updateNotificationConfiguration_streamARN' - The Amazon Resource Name (ARN) of the Kinesis video stream from where
-- you want to update the notification configuration. You must specify
-- either the @StreamName@ or the @StreamARN@.
--
-- 'streamName', 'updateNotificationConfiguration_streamName' - The name of the stream from which to update the notification
-- configuration. You must specify either the @StreamName@ or the
-- @StreamARN@.
newUpdateNotificationConfiguration ::
  UpdateNotificationConfiguration
newUpdateNotificationConfiguration :: UpdateNotificationConfiguration
newUpdateNotificationConfiguration =
  UpdateNotificationConfiguration'
    { $sel:notificationConfiguration:UpdateNotificationConfiguration' :: Maybe NotificationConfiguration
notificationConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:streamARN:UpdateNotificationConfiguration' :: Maybe Text
streamARN = forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:UpdateNotificationConfiguration' :: Maybe Text
streamName = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

instance
  Core.AWSRequest
    UpdateNotificationConfiguration
  where
  type
    AWSResponse UpdateNotificationConfiguration =
      UpdateNotificationConfigurationResponse
  request :: (Service -> Service)
-> UpdateNotificationConfiguration
-> Request UpdateNotificationConfiguration
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 UpdateNotificationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateNotificationConfiguration)))
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 -> UpdateNotificationConfigurationResponse
UpdateNotificationConfigurationResponse'
            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
    UpdateNotificationConfiguration
  where
  hashWithSalt :: Int -> UpdateNotificationConfiguration -> Int
hashWithSalt
    Int
_salt
    UpdateNotificationConfiguration' {Maybe Text
Maybe NotificationConfiguration
streamName :: Maybe Text
streamARN :: Maybe Text
notificationConfiguration :: Maybe NotificationConfiguration
$sel:streamName:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> Maybe Text
$sel:streamARN:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> Maybe Text
$sel:notificationConfiguration:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> Maybe NotificationConfiguration
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotificationConfiguration
notificationConfiguration
        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
    UpdateNotificationConfiguration
  where
  rnf :: UpdateNotificationConfiguration -> ()
rnf UpdateNotificationConfiguration' {Maybe Text
Maybe NotificationConfiguration
streamName :: Maybe Text
streamARN :: Maybe Text
notificationConfiguration :: Maybe NotificationConfiguration
$sel:streamName:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> Maybe Text
$sel:streamARN:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> Maybe Text
$sel:notificationConfiguration:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> 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 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
    UpdateNotificationConfiguration
  where
  toHeaders :: UpdateNotificationConfiguration -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToJSON UpdateNotificationConfiguration where
  toJSON :: UpdateNotificationConfiguration -> Value
toJSON UpdateNotificationConfiguration' {Maybe Text
Maybe NotificationConfiguration
streamName :: Maybe Text
streamARN :: Maybe Text
notificationConfiguration :: Maybe NotificationConfiguration
$sel:streamName:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> Maybe Text
$sel:streamARN:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> Maybe Text
$sel:notificationConfiguration:UpdateNotificationConfiguration' :: UpdateNotificationConfiguration -> Maybe NotificationConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"NotificationConfiguration" 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 NotificationConfiguration
notificationConfiguration,
            (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 UpdateNotificationConfiguration where
  toPath :: UpdateNotificationConfiguration -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const ByteString
"/updateNotificationConfiguration"

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

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

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

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

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