{-# 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-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)
module Amazonka.Firehose.Types.SourceDescription where

import qualified Amazonka.Core as Core
import Amazonka.Firehose.Types.KinesisStreamSourceDescription
import qualified Amazonka.Lens as Lens
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
(SourceDescription -> SourceDescription -> Bool)
-> (SourceDescription -> SourceDescription -> Bool)
-> Eq SourceDescription
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]
(Int -> ReadS SourceDescription)
-> ReadS [SourceDescription]
-> ReadPrec SourceDescription
-> ReadPrec [SourceDescription]
-> Read 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
(Int -> SourceDescription -> ShowS)
-> (SourceDescription -> String)
-> ([SourceDescription] -> ShowS)
-> Show SourceDescription
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. SourceDescription -> Rep SourceDescription x)
-> (forall x. Rep SourceDescription x -> SourceDescription)
-> Generic SourceDescription
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' :: Maybe KinesisStreamSourceDescription -> SourceDescription
SourceDescription'
    { $sel:kinesisStreamSourceDescription:SourceDescription' :: Maybe KinesisStreamSourceDescription
kinesisStreamSourceDescription =
        Maybe 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 :: (Maybe KinesisStreamSourceDescription
 -> f (Maybe KinesisStreamSourceDescription))
-> SourceDescription -> f SourceDescription
sourceDescription_kinesisStreamSourceDescription = (SourceDescription -> Maybe KinesisStreamSourceDescription)
-> (SourceDescription
    -> Maybe KinesisStreamSourceDescription -> SourceDescription)
-> Lens
     SourceDescription
     SourceDescription
     (Maybe KinesisStreamSourceDescription)
     (Maybe 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 Core.FromJSON SourceDescription where
  parseJSON :: Value -> Parser SourceDescription
parseJSON =
    String
-> (Object -> Parser SourceDescription)
-> Value
-> Parser SourceDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SourceDescription"
      ( \Object
x ->
          Maybe KinesisStreamSourceDescription -> SourceDescription
SourceDescription'
            (Maybe KinesisStreamSourceDescription -> SourceDescription)
-> Parser (Maybe KinesisStreamSourceDescription)
-> Parser SourceDescription
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe KinesisStreamSourceDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KinesisStreamSourceDescription")
      )

instance Prelude.Hashable SourceDescription

instance Prelude.NFData SourceDescription