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

import Amazonka.CloudFront.Types.KinesisStreamConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the Amazon Kinesis data stream where you are
-- sending real-time log data in a real-time log configuration.
--
-- /See:/ 'newEndPoint' smart constructor.
data EndPoint = EndPoint'
  { -- | Contains information about the Amazon Kinesis data stream where you are
    -- sending real-time log data.
    EndPoint -> Maybe KinesisStreamConfig
kinesisStreamConfig :: Prelude.Maybe KinesisStreamConfig,
    -- | The type of data stream where you are sending real-time log data. The
    -- only valid value is @Kinesis@.
    EndPoint -> Text
streamType :: Prelude.Text
  }
  deriving (EndPoint -> EndPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndPoint -> EndPoint -> Bool
$c/= :: EndPoint -> EndPoint -> Bool
== :: EndPoint -> EndPoint -> Bool
$c== :: EndPoint -> EndPoint -> Bool
Prelude.Eq, ReadPrec [EndPoint]
ReadPrec EndPoint
Int -> ReadS EndPoint
ReadS [EndPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndPoint]
$creadListPrec :: ReadPrec [EndPoint]
readPrec :: ReadPrec EndPoint
$creadPrec :: ReadPrec EndPoint
readList :: ReadS [EndPoint]
$creadList :: ReadS [EndPoint]
readsPrec :: Int -> ReadS EndPoint
$creadsPrec :: Int -> ReadS EndPoint
Prelude.Read, Int -> EndPoint -> ShowS
[EndPoint] -> ShowS
EndPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndPoint] -> ShowS
$cshowList :: [EndPoint] -> ShowS
show :: EndPoint -> String
$cshow :: EndPoint -> String
showsPrec :: Int -> EndPoint -> ShowS
$cshowsPrec :: Int -> EndPoint -> ShowS
Prelude.Show, forall x. Rep EndPoint x -> EndPoint
forall x. EndPoint -> Rep EndPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndPoint x -> EndPoint
$cfrom :: forall x. EndPoint -> Rep EndPoint x
Prelude.Generic)

-- |
-- Create a value of 'EndPoint' 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:
--
-- 'kinesisStreamConfig', 'endPoint_kinesisStreamConfig' - Contains information about the Amazon Kinesis data stream where you are
-- sending real-time log data.
--
-- 'streamType', 'endPoint_streamType' - The type of data stream where you are sending real-time log data. The
-- only valid value is @Kinesis@.
newEndPoint ::
  -- | 'streamType'
  Prelude.Text ->
  EndPoint
newEndPoint :: Text -> EndPoint
newEndPoint Text
pStreamType_ =
  EndPoint'
    { $sel:kinesisStreamConfig:EndPoint' :: Maybe KinesisStreamConfig
kinesisStreamConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:streamType:EndPoint' :: Text
streamType = Text
pStreamType_
    }

-- | Contains information about the Amazon Kinesis data stream where you are
-- sending real-time log data.
endPoint_kinesisStreamConfig :: Lens.Lens' EndPoint (Prelude.Maybe KinesisStreamConfig)
endPoint_kinesisStreamConfig :: Lens' EndPoint (Maybe KinesisStreamConfig)
endPoint_kinesisStreamConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndPoint' {Maybe KinesisStreamConfig
kinesisStreamConfig :: Maybe KinesisStreamConfig
$sel:kinesisStreamConfig:EndPoint' :: EndPoint -> Maybe KinesisStreamConfig
kinesisStreamConfig} -> Maybe KinesisStreamConfig
kinesisStreamConfig) (\s :: EndPoint
s@EndPoint' {} Maybe KinesisStreamConfig
a -> EndPoint
s {$sel:kinesisStreamConfig:EndPoint' :: Maybe KinesisStreamConfig
kinesisStreamConfig = Maybe KinesisStreamConfig
a} :: EndPoint)

-- | The type of data stream where you are sending real-time log data. The
-- only valid value is @Kinesis@.
endPoint_streamType :: Lens.Lens' EndPoint Prelude.Text
endPoint_streamType :: Lens' EndPoint Text
endPoint_streamType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndPoint' {Text
streamType :: Text
$sel:streamType:EndPoint' :: EndPoint -> Text
streamType} -> Text
streamType) (\s :: EndPoint
s@EndPoint' {} Text
a -> EndPoint
s {$sel:streamType:EndPoint' :: Text
streamType = Text
a} :: EndPoint)

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

instance Prelude.Hashable EndPoint where
  hashWithSalt :: Int -> EndPoint -> Int
hashWithSalt Int
_salt EndPoint' {Maybe KinesisStreamConfig
Text
streamType :: Text
kinesisStreamConfig :: Maybe KinesisStreamConfig
$sel:streamType:EndPoint' :: EndPoint -> Text
$sel:kinesisStreamConfig:EndPoint' :: EndPoint -> Maybe KinesisStreamConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KinesisStreamConfig
kinesisStreamConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
streamType

instance Prelude.NFData EndPoint where
  rnf :: EndPoint -> ()
rnf EndPoint' {Maybe KinesisStreamConfig
Text
streamType :: Text
kinesisStreamConfig :: Maybe KinesisStreamConfig
$sel:streamType:EndPoint' :: EndPoint -> Text
$sel:kinesisStreamConfig:EndPoint' :: EndPoint -> Maybe KinesisStreamConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe KinesisStreamConfig
kinesisStreamConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
streamType

instance Data.ToXML EndPoint where
  toXML :: EndPoint -> XML
toXML EndPoint' {Maybe KinesisStreamConfig
Text
streamType :: Text
kinesisStreamConfig :: Maybe KinesisStreamConfig
$sel:streamType:EndPoint' :: EndPoint -> Text
$sel:kinesisStreamConfig:EndPoint' :: EndPoint -> Maybe KinesisStreamConfig
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"KinesisStreamConfig" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe KinesisStreamConfig
kinesisStreamConfig,
        Name
"StreamType" forall a. ToXML a => Name -> a -> XML
Data.@= Text
streamType
      ]