{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Firehose.Types.SourceDescription
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Firehose.Types.SourceDescription where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Firehose.Types.KinesisStreamSourceDescription
import qualified Amazonka.Prelude as Prelude

-- | Details about a Kinesis data stream used as the source for a Kinesis
-- Data Firehose delivery stream.
--
-- /See:/ 'newSourceDescription' smart constructor.
data SourceDescription = SourceDescription'
  { -- | The KinesisStreamSourceDescription value for the source Kinesis data
    -- stream.
    SourceDescription -> Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription :: Prelude.Maybe KinesisStreamSourceDescription
  }
  deriving (SourceDescription -> SourceDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceDescription -> SourceDescription -> Bool
$c/= :: SourceDescription -> SourceDescription -> Bool
== :: SourceDescription -> SourceDescription -> Bool
$c== :: SourceDescription -> SourceDescription -> Bool
Prelude.Eq, ReadPrec [SourceDescription]
ReadPrec SourceDescription
Int -> ReadS SourceDescription
ReadS [SourceDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceDescription]
$creadListPrec :: ReadPrec [SourceDescription]
readPrec :: ReadPrec SourceDescription
$creadPrec :: ReadPrec SourceDescription
readList :: ReadS [SourceDescription]
$creadList :: ReadS [SourceDescription]
readsPrec :: Int -> ReadS SourceDescription
$creadsPrec :: Int -> ReadS SourceDescription
Prelude.Read, Int -> SourceDescription -> ShowS
[SourceDescription] -> ShowS
SourceDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceDescription] -> ShowS
$cshowList :: [SourceDescription] -> ShowS
show :: SourceDescription -> String
$cshow :: SourceDescription -> String
showsPrec :: Int -> SourceDescription -> ShowS
$cshowsPrec :: Int -> SourceDescription -> ShowS
Prelude.Show, forall x. Rep SourceDescription x -> SourceDescription
forall x. SourceDescription -> Rep SourceDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceDescription x -> SourceDescription
$cfrom :: forall x. SourceDescription -> Rep SourceDescription x
Prelude.Generic)

-- |
-- Create a value of 'SourceDescription' 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:
--
-- 'kinesisStreamSourceDescription', 'sourceDescription_kinesisStreamSourceDescription' - The KinesisStreamSourceDescription value for the source Kinesis data
-- stream.
newSourceDescription ::
  SourceDescription
newSourceDescription :: SourceDescription
newSourceDescription =
  SourceDescription'
    { $sel:kinesisStreamSourceDescription:SourceDescription' :: Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The KinesisStreamSourceDescription value for the source Kinesis data
-- stream.
sourceDescription_kinesisStreamSourceDescription :: Lens.Lens' SourceDescription (Prelude.Maybe KinesisStreamSourceDescription)
sourceDescription_kinesisStreamSourceDescription :: Lens' SourceDescription (Maybe KinesisStreamSourceDescription)
sourceDescription_kinesisStreamSourceDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceDescription' {Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription :: Maybe KinesisStreamSourceDescription
$sel:kinesisStreamSourceDescription:SourceDescription' :: SourceDescription -> Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription} -> Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription) (\s :: SourceDescription
s@SourceDescription' {} Maybe KinesisStreamSourceDescription
a -> SourceDescription
s {$sel:kinesisStreamSourceDescription:SourceDescription' :: Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription = Maybe KinesisStreamSourceDescription
a} :: SourceDescription)

instance Data.FromJSON SourceDescription where
  parseJSON :: Value -> Parser SourceDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SourceDescription"
      ( \Object
x ->
          Maybe KinesisStreamSourceDescription -> SourceDescription
SourceDescription'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"KinesisStreamSourceDescription")
      )

instance Prelude.Hashable SourceDescription where
  hashWithSalt :: Int -> SourceDescription -> Int
hashWithSalt Int
_salt SourceDescription' {Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription :: Maybe KinesisStreamSourceDescription
$sel:kinesisStreamSourceDescription:SourceDescription' :: SourceDescription -> Maybe KinesisStreamSourceDescription
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription

instance Prelude.NFData SourceDescription where
  rnf :: SourceDescription -> ()
rnf SourceDescription' {Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription :: Maybe KinesisStreamSourceDescription
$sel:kinesisStreamSourceDescription:SourceDescription' :: SourceDescription -> Maybe KinesisStreamSourceDescription
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription