{-# 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.Pinpoint.Types.EventStream
-- 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.Pinpoint.Types.EventStream where

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

-- | Specifies settings for publishing event data to an Amazon Kinesis data
-- stream or an Amazon Kinesis Data Firehose delivery stream.
--
-- /See:/ 'newEventStream' smart constructor.
data EventStream = EventStream'
  { -- | The IAM user who last modified the event stream.
    EventStream -> Maybe Text
lastUpdatedBy :: Prelude.Maybe Prelude.Text,
    -- | The date, in ISO 8601 format, when the event stream was last modified.
    EventStream -> Maybe Text
lastModifiedDate :: Prelude.Maybe Prelude.Text,
    -- | (Deprecated) Your AWS account ID, which you assigned to an external ID
    -- key in an IAM trust policy. Amazon Pinpoint previously used this value
    -- to assume an IAM role when publishing event data, but we removed this
    -- requirement. We don\'t recommend use of external IDs for IAM roles that
    -- are assumed by Amazon Pinpoint.
    EventStream -> Maybe Text
externalId :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the application to publish event data for.
    EventStream -> Text
applicationId :: Prelude.Text,
    -- | The AWS Identity and Access Management (IAM) role that authorizes Amazon
    -- Pinpoint to publish event data to the stream in your AWS account.
    EventStream -> Text
roleArn :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Amazon Kinesis data stream or
    -- Amazon Kinesis Data Firehose delivery stream to publish event data to.
    --
    -- For a Kinesis data stream, the ARN format is:
    -- arn:aws:kinesis:region:account-id:stream\/stream_name
    --
    -- For a Kinesis Data Firehose delivery stream, the ARN format is:
    -- arn:aws:firehose:region:account-id:deliverystream\/stream_name
    EventStream -> Text
destinationStreamArn :: Prelude.Text
  }
  deriving (EventStream -> EventStream -> Bool
(EventStream -> EventStream -> Bool)
-> (EventStream -> EventStream -> Bool) -> Eq EventStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventStream -> EventStream -> Bool
$c/= :: EventStream -> EventStream -> Bool
== :: EventStream -> EventStream -> Bool
$c== :: EventStream -> EventStream -> Bool
Prelude.Eq, ReadPrec [EventStream]
ReadPrec EventStream
Int -> ReadS EventStream
ReadS [EventStream]
(Int -> ReadS EventStream)
-> ReadS [EventStream]
-> ReadPrec EventStream
-> ReadPrec [EventStream]
-> Read EventStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventStream]
$creadListPrec :: ReadPrec [EventStream]
readPrec :: ReadPrec EventStream
$creadPrec :: ReadPrec EventStream
readList :: ReadS [EventStream]
$creadList :: ReadS [EventStream]
readsPrec :: Int -> ReadS EventStream
$creadsPrec :: Int -> ReadS EventStream
Prelude.Read, Int -> EventStream -> ShowS
[EventStream] -> ShowS
EventStream -> String
(Int -> EventStream -> ShowS)
-> (EventStream -> String)
-> ([EventStream] -> ShowS)
-> Show EventStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventStream] -> ShowS
$cshowList :: [EventStream] -> ShowS
show :: EventStream -> String
$cshow :: EventStream -> String
showsPrec :: Int -> EventStream -> ShowS
$cshowsPrec :: Int -> EventStream -> ShowS
Prelude.Show, (forall x. EventStream -> Rep EventStream x)
-> (forall x. Rep EventStream x -> EventStream)
-> Generic EventStream
forall x. Rep EventStream x -> EventStream
forall x. EventStream -> Rep EventStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventStream x -> EventStream
$cfrom :: forall x. EventStream -> Rep EventStream x
Prelude.Generic)

-- |
-- Create a value of 'EventStream' 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:
--
-- 'lastUpdatedBy', 'eventStream_lastUpdatedBy' - The IAM user who last modified the event stream.
--
-- 'lastModifiedDate', 'eventStream_lastModifiedDate' - The date, in ISO 8601 format, when the event stream was last modified.
--
-- 'externalId', 'eventStream_externalId' - (Deprecated) Your AWS account ID, which you assigned to an external ID
-- key in an IAM trust policy. Amazon Pinpoint previously used this value
-- to assume an IAM role when publishing event data, but we removed this
-- requirement. We don\'t recommend use of external IDs for IAM roles that
-- are assumed by Amazon Pinpoint.
--
-- 'applicationId', 'eventStream_applicationId' - The unique identifier for the application to publish event data for.
--
-- 'roleArn', 'eventStream_roleArn' - The AWS Identity and Access Management (IAM) role that authorizes Amazon
-- Pinpoint to publish event data to the stream in your AWS account.
--
-- 'destinationStreamArn', 'eventStream_destinationStreamArn' - The Amazon Resource Name (ARN) of the Amazon Kinesis data stream or
-- Amazon Kinesis Data Firehose delivery stream to publish event data to.
--
-- For a Kinesis data stream, the ARN format is:
-- arn:aws:kinesis:region:account-id:stream\/stream_name
--
-- For a Kinesis Data Firehose delivery stream, the ARN format is:
-- arn:aws:firehose:region:account-id:deliverystream\/stream_name
newEventStream ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'destinationStreamArn'
  Prelude.Text ->
  EventStream
newEventStream :: Text -> Text -> Text -> EventStream
newEventStream
  Text
pApplicationId_
  Text
pRoleArn_
  Text
pDestinationStreamArn_ =
    EventStream' :: Maybe Text
-> Maybe Text -> Maybe Text -> Text -> Text -> Text -> EventStream
EventStream'
      { $sel:lastUpdatedBy:EventStream' :: Maybe Text
lastUpdatedBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:lastModifiedDate:EventStream' :: Maybe Text
lastModifiedDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:externalId:EventStream' :: Maybe Text
externalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationId:EventStream' :: Text
applicationId = Text
pApplicationId_,
        $sel:roleArn:EventStream' :: Text
roleArn = Text
pRoleArn_,
        $sel:destinationStreamArn:EventStream' :: Text
destinationStreamArn = Text
pDestinationStreamArn_
      }

-- | The IAM user who last modified the event stream.
eventStream_lastUpdatedBy :: Lens.Lens' EventStream (Prelude.Maybe Prelude.Text)
eventStream_lastUpdatedBy :: (Maybe Text -> f (Maybe Text)) -> EventStream -> f EventStream
eventStream_lastUpdatedBy = (EventStream -> Maybe Text)
-> (EventStream -> Maybe Text -> EventStream)
-> Lens EventStream EventStream (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventStream' {Maybe Text
lastUpdatedBy :: Maybe Text
$sel:lastUpdatedBy:EventStream' :: EventStream -> Maybe Text
lastUpdatedBy} -> Maybe Text
lastUpdatedBy) (\s :: EventStream
s@EventStream' {} Maybe Text
a -> EventStream
s {$sel:lastUpdatedBy:EventStream' :: Maybe Text
lastUpdatedBy = Maybe Text
a} :: EventStream)

-- | The date, in ISO 8601 format, when the event stream was last modified.
eventStream_lastModifiedDate :: Lens.Lens' EventStream (Prelude.Maybe Prelude.Text)
eventStream_lastModifiedDate :: (Maybe Text -> f (Maybe Text)) -> EventStream -> f EventStream
eventStream_lastModifiedDate = (EventStream -> Maybe Text)
-> (EventStream -> Maybe Text -> EventStream)
-> Lens EventStream EventStream (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventStream' {Maybe Text
lastModifiedDate :: Maybe Text
$sel:lastModifiedDate:EventStream' :: EventStream -> Maybe Text
lastModifiedDate} -> Maybe Text
lastModifiedDate) (\s :: EventStream
s@EventStream' {} Maybe Text
a -> EventStream
s {$sel:lastModifiedDate:EventStream' :: Maybe Text
lastModifiedDate = Maybe Text
a} :: EventStream)

-- | (Deprecated) Your AWS account ID, which you assigned to an external ID
-- key in an IAM trust policy. Amazon Pinpoint previously used this value
-- to assume an IAM role when publishing event data, but we removed this
-- requirement. We don\'t recommend use of external IDs for IAM roles that
-- are assumed by Amazon Pinpoint.
eventStream_externalId :: Lens.Lens' EventStream (Prelude.Maybe Prelude.Text)
eventStream_externalId :: (Maybe Text -> f (Maybe Text)) -> EventStream -> f EventStream
eventStream_externalId = (EventStream -> Maybe Text)
-> (EventStream -> Maybe Text -> EventStream)
-> Lens EventStream EventStream (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventStream' {Maybe Text
externalId :: Maybe Text
$sel:externalId:EventStream' :: EventStream -> Maybe Text
externalId} -> Maybe Text
externalId) (\s :: EventStream
s@EventStream' {} Maybe Text
a -> EventStream
s {$sel:externalId:EventStream' :: Maybe Text
externalId = Maybe Text
a} :: EventStream)

-- | The unique identifier for the application to publish event data for.
eventStream_applicationId :: Lens.Lens' EventStream Prelude.Text
eventStream_applicationId :: (Text -> f Text) -> EventStream -> f EventStream
eventStream_applicationId = (EventStream -> Text)
-> (EventStream -> Text -> EventStream)
-> Lens EventStream EventStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventStream' {Text
applicationId :: Text
$sel:applicationId:EventStream' :: EventStream -> Text
applicationId} -> Text
applicationId) (\s :: EventStream
s@EventStream' {} Text
a -> EventStream
s {$sel:applicationId:EventStream' :: Text
applicationId = Text
a} :: EventStream)

-- | The AWS Identity and Access Management (IAM) role that authorizes Amazon
-- Pinpoint to publish event data to the stream in your AWS account.
eventStream_roleArn :: Lens.Lens' EventStream Prelude.Text
eventStream_roleArn :: (Text -> f Text) -> EventStream -> f EventStream
eventStream_roleArn = (EventStream -> Text)
-> (EventStream -> Text -> EventStream)
-> Lens EventStream EventStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventStream' {Text
roleArn :: Text
$sel:roleArn:EventStream' :: EventStream -> Text
roleArn} -> Text
roleArn) (\s :: EventStream
s@EventStream' {} Text
a -> EventStream
s {$sel:roleArn:EventStream' :: Text
roleArn = Text
a} :: EventStream)

-- | The Amazon Resource Name (ARN) of the Amazon Kinesis data stream or
-- Amazon Kinesis Data Firehose delivery stream to publish event data to.
--
-- For a Kinesis data stream, the ARN format is:
-- arn:aws:kinesis:region:account-id:stream\/stream_name
--
-- For a Kinesis Data Firehose delivery stream, the ARN format is:
-- arn:aws:firehose:region:account-id:deliverystream\/stream_name
eventStream_destinationStreamArn :: Lens.Lens' EventStream Prelude.Text
eventStream_destinationStreamArn :: (Text -> f Text) -> EventStream -> f EventStream
eventStream_destinationStreamArn = (EventStream -> Text)
-> (EventStream -> Text -> EventStream)
-> Lens EventStream EventStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventStream' {Text
destinationStreamArn :: Text
$sel:destinationStreamArn:EventStream' :: EventStream -> Text
destinationStreamArn} -> Text
destinationStreamArn) (\s :: EventStream
s@EventStream' {} Text
a -> EventStream
s {$sel:destinationStreamArn:EventStream' :: Text
destinationStreamArn = Text
a} :: EventStream)

instance Core.FromJSON EventStream where
  parseJSON :: Value -> Parser EventStream
parseJSON =
    String
-> (Object -> Parser EventStream) -> Value -> Parser EventStream
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EventStream"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Text -> Text -> Text -> EventStream
EventStream'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Text -> Text -> Text -> EventStream)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Text -> Text -> Text -> EventStream)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdatedBy")
            Parser
  (Maybe Text -> Maybe Text -> Text -> Text -> Text -> EventStream)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> Text -> Text -> EventStream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastModifiedDate")
            Parser (Maybe Text -> Text -> Text -> Text -> EventStream)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> Text -> EventStream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExternalId")
            Parser (Text -> Text -> Text -> EventStream)
-> Parser Text -> Parser (Text -> Text -> EventStream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ApplicationId")
            Parser (Text -> Text -> EventStream)
-> Parser Text -> Parser (Text -> EventStream)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RoleArn")
            Parser (Text -> EventStream) -> Parser Text -> Parser EventStream
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DestinationStreamArn")
      )

instance Prelude.Hashable EventStream

instance Prelude.NFData EventStream