{-# 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.CloudFront.Types.KinesisStreamConfig
-- 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.CloudFront.Types.KinesisStreamConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the Amazon Kinesis data stream where you are
-- sending real-time log data.
--
-- /See:/ 'newKinesisStreamConfig' smart constructor.
data KinesisStreamConfig = KinesisStreamConfig'
  { -- | The Amazon Resource Name (ARN) of an Identity and Access Management
    -- (IAM) role that CloudFront can use to send real-time log data to your
    -- Kinesis data stream.
    --
    -- For more information the IAM role, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-iam-role Real-time log configuration IAM role>
    -- in the /Amazon CloudFront Developer Guide/.
    KinesisStreamConfig -> Text
roleARN :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Kinesis data stream where you are
    -- sending real-time log data.
    KinesisStreamConfig -> Text
streamARN :: Prelude.Text
  }
  deriving (KinesisStreamConfig -> KinesisStreamConfig -> Bool
(KinesisStreamConfig -> KinesisStreamConfig -> Bool)
-> (KinesisStreamConfig -> KinesisStreamConfig -> Bool)
-> Eq KinesisStreamConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KinesisStreamConfig -> KinesisStreamConfig -> Bool
$c/= :: KinesisStreamConfig -> KinesisStreamConfig -> Bool
== :: KinesisStreamConfig -> KinesisStreamConfig -> Bool
$c== :: KinesisStreamConfig -> KinesisStreamConfig -> Bool
Prelude.Eq, ReadPrec [KinesisStreamConfig]
ReadPrec KinesisStreamConfig
Int -> ReadS KinesisStreamConfig
ReadS [KinesisStreamConfig]
(Int -> ReadS KinesisStreamConfig)
-> ReadS [KinesisStreamConfig]
-> ReadPrec KinesisStreamConfig
-> ReadPrec [KinesisStreamConfig]
-> Read KinesisStreamConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KinesisStreamConfig]
$creadListPrec :: ReadPrec [KinesisStreamConfig]
readPrec :: ReadPrec KinesisStreamConfig
$creadPrec :: ReadPrec KinesisStreamConfig
readList :: ReadS [KinesisStreamConfig]
$creadList :: ReadS [KinesisStreamConfig]
readsPrec :: Int -> ReadS KinesisStreamConfig
$creadsPrec :: Int -> ReadS KinesisStreamConfig
Prelude.Read, Int -> KinesisStreamConfig -> ShowS
[KinesisStreamConfig] -> ShowS
KinesisStreamConfig -> String
(Int -> KinesisStreamConfig -> ShowS)
-> (KinesisStreamConfig -> String)
-> ([KinesisStreamConfig] -> ShowS)
-> Show KinesisStreamConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KinesisStreamConfig] -> ShowS
$cshowList :: [KinesisStreamConfig] -> ShowS
show :: KinesisStreamConfig -> String
$cshow :: KinesisStreamConfig -> String
showsPrec :: Int -> KinesisStreamConfig -> ShowS
$cshowsPrec :: Int -> KinesisStreamConfig -> ShowS
Prelude.Show, (forall x. KinesisStreamConfig -> Rep KinesisStreamConfig x)
-> (forall x. Rep KinesisStreamConfig x -> KinesisStreamConfig)
-> Generic KinesisStreamConfig
forall x. Rep KinesisStreamConfig x -> KinesisStreamConfig
forall x. KinesisStreamConfig -> Rep KinesisStreamConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KinesisStreamConfig x -> KinesisStreamConfig
$cfrom :: forall x. KinesisStreamConfig -> Rep KinesisStreamConfig x
Prelude.Generic)

-- |
-- Create a value of 'KinesisStreamConfig' 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:
--
-- 'roleARN', 'kinesisStreamConfig_roleARN' - The Amazon Resource Name (ARN) of an Identity and Access Management
-- (IAM) role that CloudFront can use to send real-time log data to your
-- Kinesis data stream.
--
-- For more information the IAM role, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-iam-role Real-time log configuration IAM role>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'streamARN', 'kinesisStreamConfig_streamARN' - The Amazon Resource Name (ARN) of the Kinesis data stream where you are
-- sending real-time log data.
newKinesisStreamConfig ::
  -- | 'roleARN'
  Prelude.Text ->
  -- | 'streamARN'
  Prelude.Text ->
  KinesisStreamConfig
newKinesisStreamConfig :: Text -> Text -> KinesisStreamConfig
newKinesisStreamConfig Text
pRoleARN_ Text
pStreamARN_ =
  KinesisStreamConfig' :: Text -> Text -> KinesisStreamConfig
KinesisStreamConfig'
    { $sel:roleARN:KinesisStreamConfig' :: Text
roleARN = Text
pRoleARN_,
      $sel:streamARN:KinesisStreamConfig' :: Text
streamARN = Text
pStreamARN_
    }

-- | The Amazon Resource Name (ARN) of an Identity and Access Management
-- (IAM) role that CloudFront can use to send real-time log data to your
-- Kinesis data stream.
--
-- For more information the IAM role, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-iam-role Real-time log configuration IAM role>
-- in the /Amazon CloudFront Developer Guide/.
kinesisStreamConfig_roleARN :: Lens.Lens' KinesisStreamConfig Prelude.Text
kinesisStreamConfig_roleARN :: (Text -> f Text) -> KinesisStreamConfig -> f KinesisStreamConfig
kinesisStreamConfig_roleARN = (KinesisStreamConfig -> Text)
-> (KinesisStreamConfig -> Text -> KinesisStreamConfig)
-> Lens KinesisStreamConfig KinesisStreamConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisStreamConfig' {Text
roleARN :: Text
$sel:roleARN:KinesisStreamConfig' :: KinesisStreamConfig -> Text
roleARN} -> Text
roleARN) (\s :: KinesisStreamConfig
s@KinesisStreamConfig' {} Text
a -> KinesisStreamConfig
s {$sel:roleARN:KinesisStreamConfig' :: Text
roleARN = Text
a} :: KinesisStreamConfig)

-- | The Amazon Resource Name (ARN) of the Kinesis data stream where you are
-- sending real-time log data.
kinesisStreamConfig_streamARN :: Lens.Lens' KinesisStreamConfig Prelude.Text
kinesisStreamConfig_streamARN :: (Text -> f Text) -> KinesisStreamConfig -> f KinesisStreamConfig
kinesisStreamConfig_streamARN = (KinesisStreamConfig -> Text)
-> (KinesisStreamConfig -> Text -> KinesisStreamConfig)
-> Lens KinesisStreamConfig KinesisStreamConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisStreamConfig' {Text
streamARN :: Text
$sel:streamARN:KinesisStreamConfig' :: KinesisStreamConfig -> Text
streamARN} -> Text
streamARN) (\s :: KinesisStreamConfig
s@KinesisStreamConfig' {} Text
a -> KinesisStreamConfig
s {$sel:streamARN:KinesisStreamConfig' :: Text
streamARN = Text
a} :: KinesisStreamConfig)

instance Core.FromXML KinesisStreamConfig where
  parseXML :: [Node] -> Either String KinesisStreamConfig
parseXML [Node]
x =
    Text -> Text -> KinesisStreamConfig
KinesisStreamConfig'
      (Text -> Text -> KinesisStreamConfig)
-> Either String Text
-> Either String (Text -> KinesisStreamConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"RoleARN")
      Either String (Text -> KinesisStreamConfig)
-> Either String Text -> Either String KinesisStreamConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"StreamARN")

instance Prelude.Hashable KinesisStreamConfig

instance Prelude.NFData KinesisStreamConfig

instance Core.ToXML KinesisStreamConfig where
  toXML :: KinesisStreamConfig -> XML
toXML KinesisStreamConfig' {Text
streamARN :: Text
roleARN :: Text
$sel:streamARN:KinesisStreamConfig' :: KinesisStreamConfig -> Text
$sel:roleARN:KinesisStreamConfig' :: KinesisStreamConfig -> Text
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"RoleARN" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
roleARN,
        Name
"StreamARN" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
streamARN
      ]