{-# 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.StreamingDistribution
-- 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.StreamingDistribution where

import Amazonka.CloudFront.Types.ActiveTrustedSigners
import Amazonka.CloudFront.Types.StreamingDistributionConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A streaming distribution tells CloudFront where you want RTMP content to
-- be delivered from, and the details about how to track and manage content
-- delivery.
--
-- /See:/ 'newStreamingDistribution' smart constructor.
data StreamingDistribution = StreamingDistribution'
  { -- | The date and time that the distribution was last modified.
    StreamingDistribution -> Maybe ISO8601
lastModifiedTime :: Prelude.Maybe Core.ISO8601,
    -- | The identifier for the RTMP distribution. For example:
    -- @EGTXBD79EXAMPLE@.
    StreamingDistribution -> Text
id :: Prelude.Text,
    -- | The ARN (Amazon Resource Name) for the distribution. For example:
    -- @arn:aws:cloudfront::123456789012:distribution\/EDFDVBD632BHDS5@, where
    -- @123456789012@ is your account ID.
    StreamingDistribution -> Text
arn :: Prelude.Text,
    -- | The current status of the RTMP distribution. When the status is
    -- @Deployed@, the distribution\'s information is propagated to all
    -- CloudFront edge locations.
    StreamingDistribution -> Text
status :: Prelude.Text,
    -- | The domain name that corresponds to the streaming distribution, for
    -- example, @s5c39gqb8ow64r.cloudfront.net@.
    StreamingDistribution -> Text
domainName :: Prelude.Text,
    -- | A complex type that lists the accounts, if any, that you included in the
    -- @TrustedSigners@ complex type for this distribution. These are the
    -- accounts that you want to allow to create signed URLs for private
    -- content.
    --
    -- The @Signer@ complex type lists the account number of the trusted signer
    -- or @self@ if the signer is the account that created the distribution.
    -- The @Signer@ element also includes the IDs of any active CloudFront key
    -- pairs that are associated with the trusted signer\'s account. If no
    -- @KeyPairId@ element appears for a @Signer@, that signer can\'t create
    -- signed URLs.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving Private Content through CloudFront>
    -- in the /Amazon CloudFront Developer Guide/.
    StreamingDistribution -> ActiveTrustedSigners
activeTrustedSigners :: ActiveTrustedSigners,
    -- | The current configuration information for the RTMP distribution.
    StreamingDistribution -> StreamingDistributionConfig
streamingDistributionConfig :: StreamingDistributionConfig
  }
  deriving (StreamingDistribution -> StreamingDistribution -> Bool
(StreamingDistribution -> StreamingDistribution -> Bool)
-> (StreamingDistribution -> StreamingDistribution -> Bool)
-> Eq StreamingDistribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamingDistribution -> StreamingDistribution -> Bool
$c/= :: StreamingDistribution -> StreamingDistribution -> Bool
== :: StreamingDistribution -> StreamingDistribution -> Bool
$c== :: StreamingDistribution -> StreamingDistribution -> Bool
Prelude.Eq, ReadPrec [StreamingDistribution]
ReadPrec StreamingDistribution
Int -> ReadS StreamingDistribution
ReadS [StreamingDistribution]
(Int -> ReadS StreamingDistribution)
-> ReadS [StreamingDistribution]
-> ReadPrec StreamingDistribution
-> ReadPrec [StreamingDistribution]
-> Read StreamingDistribution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamingDistribution]
$creadListPrec :: ReadPrec [StreamingDistribution]
readPrec :: ReadPrec StreamingDistribution
$creadPrec :: ReadPrec StreamingDistribution
readList :: ReadS [StreamingDistribution]
$creadList :: ReadS [StreamingDistribution]
readsPrec :: Int -> ReadS StreamingDistribution
$creadsPrec :: Int -> ReadS StreamingDistribution
Prelude.Read, Int -> StreamingDistribution -> ShowS
[StreamingDistribution] -> ShowS
StreamingDistribution -> String
(Int -> StreamingDistribution -> ShowS)
-> (StreamingDistribution -> String)
-> ([StreamingDistribution] -> ShowS)
-> Show StreamingDistribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamingDistribution] -> ShowS
$cshowList :: [StreamingDistribution] -> ShowS
show :: StreamingDistribution -> String
$cshow :: StreamingDistribution -> String
showsPrec :: Int -> StreamingDistribution -> ShowS
$cshowsPrec :: Int -> StreamingDistribution -> ShowS
Prelude.Show, (forall x. StreamingDistribution -> Rep StreamingDistribution x)
-> (forall x. Rep StreamingDistribution x -> StreamingDistribution)
-> Generic StreamingDistribution
forall x. Rep StreamingDistribution x -> StreamingDistribution
forall x. StreamingDistribution -> Rep StreamingDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamingDistribution x -> StreamingDistribution
$cfrom :: forall x. StreamingDistribution -> Rep StreamingDistribution x
Prelude.Generic)

-- |
-- Create a value of 'StreamingDistribution' 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:
--
-- 'lastModifiedTime', 'streamingDistribution_lastModifiedTime' - The date and time that the distribution was last modified.
--
-- 'id', 'streamingDistribution_id' - The identifier for the RTMP distribution. For example:
-- @EGTXBD79EXAMPLE@.
--
-- 'arn', 'streamingDistribution_arn' - The ARN (Amazon Resource Name) for the distribution. For example:
-- @arn:aws:cloudfront::123456789012:distribution\/EDFDVBD632BHDS5@, where
-- @123456789012@ is your account ID.
--
-- 'status', 'streamingDistribution_status' - The current status of the RTMP distribution. When the status is
-- @Deployed@, the distribution\'s information is propagated to all
-- CloudFront edge locations.
--
-- 'domainName', 'streamingDistribution_domainName' - The domain name that corresponds to the streaming distribution, for
-- example, @s5c39gqb8ow64r.cloudfront.net@.
--
-- 'activeTrustedSigners', 'streamingDistribution_activeTrustedSigners' - A complex type that lists the accounts, if any, that you included in the
-- @TrustedSigners@ complex type for this distribution. These are the
-- accounts that you want to allow to create signed URLs for private
-- content.
--
-- The @Signer@ complex type lists the account number of the trusted signer
-- or @self@ if the signer is the account that created the distribution.
-- The @Signer@ element also includes the IDs of any active CloudFront key
-- pairs that are associated with the trusted signer\'s account. If no
-- @KeyPairId@ element appears for a @Signer@, that signer can\'t create
-- signed URLs.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving Private Content through CloudFront>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'streamingDistributionConfig', 'streamingDistribution_streamingDistributionConfig' - The current configuration information for the RTMP distribution.
newStreamingDistribution ::
  -- | 'id'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'status'
  Prelude.Text ->
  -- | 'domainName'
  Prelude.Text ->
  -- | 'activeTrustedSigners'
  ActiveTrustedSigners ->
  -- | 'streamingDistributionConfig'
  StreamingDistributionConfig ->
  StreamingDistribution
newStreamingDistribution :: Text
-> Text
-> Text
-> Text
-> ActiveTrustedSigners
-> StreamingDistributionConfig
-> StreamingDistribution
newStreamingDistribution
  Text
pId_
  Text
pARN_
  Text
pStatus_
  Text
pDomainName_
  ActiveTrustedSigners
pActiveTrustedSigners_
  StreamingDistributionConfig
pStreamingDistributionConfig_ =
    StreamingDistribution' :: Maybe ISO8601
-> Text
-> Text
-> Text
-> Text
-> ActiveTrustedSigners
-> StreamingDistributionConfig
-> StreamingDistribution
StreamingDistribution'
      { $sel:lastModifiedTime:StreamingDistribution' :: Maybe ISO8601
lastModifiedTime =
          Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
        $sel:id:StreamingDistribution' :: Text
id = Text
pId_,
        $sel:arn:StreamingDistribution' :: Text
arn = Text
pARN_,
        $sel:status:StreamingDistribution' :: Text
status = Text
pStatus_,
        $sel:domainName:StreamingDistribution' :: Text
domainName = Text
pDomainName_,
        $sel:activeTrustedSigners:StreamingDistribution' :: ActiveTrustedSigners
activeTrustedSigners = ActiveTrustedSigners
pActiveTrustedSigners_,
        $sel:streamingDistributionConfig:StreamingDistribution' :: StreamingDistributionConfig
streamingDistributionConfig =
          StreamingDistributionConfig
pStreamingDistributionConfig_
      }

-- | The date and time that the distribution was last modified.
streamingDistribution_lastModifiedTime :: Lens.Lens' StreamingDistribution (Prelude.Maybe Prelude.UTCTime)
streamingDistribution_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StreamingDistribution -> f StreamingDistribution
streamingDistribution_lastModifiedTime = (StreamingDistribution -> Maybe ISO8601)
-> (StreamingDistribution
    -> Maybe ISO8601 -> StreamingDistribution)
-> Lens
     StreamingDistribution
     StreamingDistribution
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistribution' {Maybe ISO8601
lastModifiedTime :: Maybe ISO8601
$sel:lastModifiedTime:StreamingDistribution' :: StreamingDistribution -> Maybe ISO8601
lastModifiedTime} -> Maybe ISO8601
lastModifiedTime) (\s :: StreamingDistribution
s@StreamingDistribution' {} Maybe ISO8601
a -> StreamingDistribution
s {$sel:lastModifiedTime:StreamingDistribution' :: Maybe ISO8601
lastModifiedTime = Maybe ISO8601
a} :: StreamingDistribution) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> StreamingDistribution -> f StreamingDistribution)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StreamingDistribution
-> f StreamingDistribution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The identifier for the RTMP distribution. For example:
-- @EGTXBD79EXAMPLE@.
streamingDistribution_id :: Lens.Lens' StreamingDistribution Prelude.Text
streamingDistribution_id :: (Text -> f Text)
-> StreamingDistribution -> f StreamingDistribution
streamingDistribution_id = (StreamingDistribution -> Text)
-> (StreamingDistribution -> Text -> StreamingDistribution)
-> Lens StreamingDistribution StreamingDistribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistribution' {Text
id :: Text
$sel:id:StreamingDistribution' :: StreamingDistribution -> Text
id} -> Text
id) (\s :: StreamingDistribution
s@StreamingDistribution' {} Text
a -> StreamingDistribution
s {$sel:id:StreamingDistribution' :: Text
id = Text
a} :: StreamingDistribution)

-- | The ARN (Amazon Resource Name) for the distribution. For example:
-- @arn:aws:cloudfront::123456789012:distribution\/EDFDVBD632BHDS5@, where
-- @123456789012@ is your account ID.
streamingDistribution_arn :: Lens.Lens' StreamingDistribution Prelude.Text
streamingDistribution_arn :: (Text -> f Text)
-> StreamingDistribution -> f StreamingDistribution
streamingDistribution_arn = (StreamingDistribution -> Text)
-> (StreamingDistribution -> Text -> StreamingDistribution)
-> Lens StreamingDistribution StreamingDistribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistribution' {Text
arn :: Text
$sel:arn:StreamingDistribution' :: StreamingDistribution -> Text
arn} -> Text
arn) (\s :: StreamingDistribution
s@StreamingDistribution' {} Text
a -> StreamingDistribution
s {$sel:arn:StreamingDistribution' :: Text
arn = Text
a} :: StreamingDistribution)

-- | The current status of the RTMP distribution. When the status is
-- @Deployed@, the distribution\'s information is propagated to all
-- CloudFront edge locations.
streamingDistribution_status :: Lens.Lens' StreamingDistribution Prelude.Text
streamingDistribution_status :: (Text -> f Text)
-> StreamingDistribution -> f StreamingDistribution
streamingDistribution_status = (StreamingDistribution -> Text)
-> (StreamingDistribution -> Text -> StreamingDistribution)
-> Lens StreamingDistribution StreamingDistribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistribution' {Text
status :: Text
$sel:status:StreamingDistribution' :: StreamingDistribution -> Text
status} -> Text
status) (\s :: StreamingDistribution
s@StreamingDistribution' {} Text
a -> StreamingDistribution
s {$sel:status:StreamingDistribution' :: Text
status = Text
a} :: StreamingDistribution)

-- | The domain name that corresponds to the streaming distribution, for
-- example, @s5c39gqb8ow64r.cloudfront.net@.
streamingDistribution_domainName :: Lens.Lens' StreamingDistribution Prelude.Text
streamingDistribution_domainName :: (Text -> f Text)
-> StreamingDistribution -> f StreamingDistribution
streamingDistribution_domainName = (StreamingDistribution -> Text)
-> (StreamingDistribution -> Text -> StreamingDistribution)
-> Lens StreamingDistribution StreamingDistribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistribution' {Text
domainName :: Text
$sel:domainName:StreamingDistribution' :: StreamingDistribution -> Text
domainName} -> Text
domainName) (\s :: StreamingDistribution
s@StreamingDistribution' {} Text
a -> StreamingDistribution
s {$sel:domainName:StreamingDistribution' :: Text
domainName = Text
a} :: StreamingDistribution)

-- | A complex type that lists the accounts, if any, that you included in the
-- @TrustedSigners@ complex type for this distribution. These are the
-- accounts that you want to allow to create signed URLs for private
-- content.
--
-- The @Signer@ complex type lists the account number of the trusted signer
-- or @self@ if the signer is the account that created the distribution.
-- The @Signer@ element also includes the IDs of any active CloudFront key
-- pairs that are associated with the trusted signer\'s account. If no
-- @KeyPairId@ element appears for a @Signer@, that signer can\'t create
-- signed URLs.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html Serving Private Content through CloudFront>
-- in the /Amazon CloudFront Developer Guide/.
streamingDistribution_activeTrustedSigners :: Lens.Lens' StreamingDistribution ActiveTrustedSigners
streamingDistribution_activeTrustedSigners :: (ActiveTrustedSigners -> f ActiveTrustedSigners)
-> StreamingDistribution -> f StreamingDistribution
streamingDistribution_activeTrustedSigners = (StreamingDistribution -> ActiveTrustedSigners)
-> (StreamingDistribution
    -> ActiveTrustedSigners -> StreamingDistribution)
-> Lens
     StreamingDistribution
     StreamingDistribution
     ActiveTrustedSigners
     ActiveTrustedSigners
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistribution' {ActiveTrustedSigners
activeTrustedSigners :: ActiveTrustedSigners
$sel:activeTrustedSigners:StreamingDistribution' :: StreamingDistribution -> ActiveTrustedSigners
activeTrustedSigners} -> ActiveTrustedSigners
activeTrustedSigners) (\s :: StreamingDistribution
s@StreamingDistribution' {} ActiveTrustedSigners
a -> StreamingDistribution
s {$sel:activeTrustedSigners:StreamingDistribution' :: ActiveTrustedSigners
activeTrustedSigners = ActiveTrustedSigners
a} :: StreamingDistribution)

-- | The current configuration information for the RTMP distribution.
streamingDistribution_streamingDistributionConfig :: Lens.Lens' StreamingDistribution StreamingDistributionConfig
streamingDistribution_streamingDistributionConfig :: (StreamingDistributionConfig -> f StreamingDistributionConfig)
-> StreamingDistribution -> f StreamingDistribution
streamingDistribution_streamingDistributionConfig = (StreamingDistribution -> StreamingDistributionConfig)
-> (StreamingDistribution
    -> StreamingDistributionConfig -> StreamingDistribution)
-> Lens
     StreamingDistribution
     StreamingDistribution
     StreamingDistributionConfig
     StreamingDistributionConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistribution' {StreamingDistributionConfig
streamingDistributionConfig :: StreamingDistributionConfig
$sel:streamingDistributionConfig:StreamingDistribution' :: StreamingDistribution -> StreamingDistributionConfig
streamingDistributionConfig} -> StreamingDistributionConfig
streamingDistributionConfig) (\s :: StreamingDistribution
s@StreamingDistribution' {} StreamingDistributionConfig
a -> StreamingDistribution
s {$sel:streamingDistributionConfig:StreamingDistribution' :: StreamingDistributionConfig
streamingDistributionConfig = StreamingDistributionConfig
a} :: StreamingDistribution)

instance Core.FromXML StreamingDistribution where
  parseXML :: [Node] -> Either String StreamingDistribution
parseXML [Node]
x =
    Maybe ISO8601
-> Text
-> Text
-> Text
-> Text
-> ActiveTrustedSigners
-> StreamingDistributionConfig
-> StreamingDistribution
StreamingDistribution'
      (Maybe ISO8601
 -> Text
 -> Text
 -> Text
 -> Text
 -> ActiveTrustedSigners
 -> StreamingDistributionConfig
 -> StreamingDistribution)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Text
      -> Text
      -> Text
      -> Text
      -> ActiveTrustedSigners
      -> StreamingDistributionConfig
      -> StreamingDistribution)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LastModifiedTime")
      Either
  String
  (Text
   -> Text
   -> Text
   -> Text
   -> ActiveTrustedSigners
   -> StreamingDistributionConfig
   -> StreamingDistribution)
-> Either String Text
-> Either
     String
     (Text
      -> Text
      -> Text
      -> ActiveTrustedSigners
      -> StreamingDistributionConfig
      -> StreamingDistribution)
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
"Id")
      Either
  String
  (Text
   -> Text
   -> Text
   -> ActiveTrustedSigners
   -> StreamingDistributionConfig
   -> StreamingDistribution)
-> Either String Text
-> Either
     String
     (Text
      -> Text
      -> ActiveTrustedSigners
      -> StreamingDistributionConfig
      -> StreamingDistribution)
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
"ARN")
      Either
  String
  (Text
   -> Text
   -> ActiveTrustedSigners
   -> StreamingDistributionConfig
   -> StreamingDistribution)
-> Either String Text
-> Either
     String
     (Text
      -> ActiveTrustedSigners
      -> StreamingDistributionConfig
      -> StreamingDistribution)
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
"Status")
      Either
  String
  (Text
   -> ActiveTrustedSigners
   -> StreamingDistributionConfig
   -> StreamingDistribution)
-> Either String Text
-> Either
     String
     (ActiveTrustedSigners
      -> StreamingDistributionConfig -> StreamingDistribution)
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
"DomainName")
      Either
  String
  (ActiveTrustedSigners
   -> StreamingDistributionConfig -> StreamingDistribution)
-> Either String ActiveTrustedSigners
-> Either
     String (StreamingDistributionConfig -> StreamingDistribution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ActiveTrustedSigners
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ActiveTrustedSigners")
      Either
  String (StreamingDistributionConfig -> StreamingDistribution)
-> Either String StreamingDistributionConfig
-> Either String StreamingDistribution
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String StreamingDistributionConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"StreamingDistributionConfig")

instance Prelude.Hashable StreamingDistribution

instance Prelude.NFData StreamingDistribution