{-# 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.MediaPackage.Types.Channel
-- 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.MediaPackage.Types.Channel where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackage.Types.EgressAccessLogs
import Amazonka.MediaPackage.Types.HlsIngest
import Amazonka.MediaPackage.Types.IngressAccessLogs
import qualified Amazonka.Prelude as Prelude

-- | A Channel resource configuration.
--
-- /See:/ 'newChannel' smart constructor.
data Channel = Channel'
  { Channel -> Maybe IngressAccessLogs
ingressAccessLogs :: Prelude.Maybe IngressAccessLogs,
    Channel -> Maybe HlsIngest
hlsIngest :: Prelude.Maybe HlsIngest,
    -- | The Amazon Resource Name (ARN) assigned to the Channel.
    Channel -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Channel.
    Channel -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | A short text description of the Channel.
    Channel -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    Channel -> Maybe EgressAccessLogs
egressAccessLogs :: Prelude.Maybe EgressAccessLogs,
    Channel -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (Channel -> Channel -> Bool
(Channel -> Channel -> Bool)
-> (Channel -> Channel -> Bool) -> Eq Channel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Channel -> Channel -> Bool
$c/= :: Channel -> Channel -> Bool
== :: Channel -> Channel -> Bool
$c== :: Channel -> Channel -> Bool
Prelude.Eq, ReadPrec [Channel]
ReadPrec Channel
Int -> ReadS Channel
ReadS [Channel]
(Int -> ReadS Channel)
-> ReadS [Channel]
-> ReadPrec Channel
-> ReadPrec [Channel]
-> Read Channel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Channel]
$creadListPrec :: ReadPrec [Channel]
readPrec :: ReadPrec Channel
$creadPrec :: ReadPrec Channel
readList :: ReadS [Channel]
$creadList :: ReadS [Channel]
readsPrec :: Int -> ReadS Channel
$creadsPrec :: Int -> ReadS Channel
Prelude.Read, Int -> Channel -> ShowS
[Channel] -> ShowS
Channel -> String
(Int -> Channel -> ShowS)
-> (Channel -> String) -> ([Channel] -> ShowS) -> Show Channel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Channel] -> ShowS
$cshowList :: [Channel] -> ShowS
show :: Channel -> String
$cshow :: Channel -> String
showsPrec :: Int -> Channel -> ShowS
$cshowsPrec :: Int -> Channel -> ShowS
Prelude.Show, (forall x. Channel -> Rep Channel x)
-> (forall x. Rep Channel x -> Channel) -> Generic Channel
forall x. Rep Channel x -> Channel
forall x. Channel -> Rep Channel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Channel x -> Channel
$cfrom :: forall x. Channel -> Rep Channel x
Prelude.Generic)

-- |
-- Create a value of 'Channel' 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:
--
-- 'ingressAccessLogs', 'channel_ingressAccessLogs' - Undocumented member.
--
-- 'hlsIngest', 'channel_hlsIngest' - Undocumented member.
--
-- 'arn', 'channel_arn' - The Amazon Resource Name (ARN) assigned to the Channel.
--
-- 'id', 'channel_id' - The ID of the Channel.
--
-- 'description', 'channel_description' - A short text description of the Channel.
--
-- 'egressAccessLogs', 'channel_egressAccessLogs' - Undocumented member.
--
-- 'tags', 'channel_tags' - Undocumented member.
newChannel ::
  Channel
newChannel :: Channel
newChannel =
  Channel' :: Maybe IngressAccessLogs
-> Maybe HlsIngest
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe EgressAccessLogs
-> Maybe (HashMap Text Text)
-> Channel
Channel'
    { $sel:ingressAccessLogs:Channel' :: Maybe IngressAccessLogs
ingressAccessLogs = Maybe IngressAccessLogs
forall a. Maybe a
Prelude.Nothing,
      $sel:hlsIngest:Channel' :: Maybe HlsIngest
hlsIngest = Maybe HlsIngest
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Channel' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:Channel' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Channel' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:egressAccessLogs:Channel' :: Maybe EgressAccessLogs
egressAccessLogs = Maybe EgressAccessLogs
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Channel' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
channel_ingressAccessLogs :: Lens.Lens' Channel (Prelude.Maybe IngressAccessLogs)
channel_ingressAccessLogs :: (Maybe IngressAccessLogs -> f (Maybe IngressAccessLogs))
-> Channel -> f Channel
channel_ingressAccessLogs = (Channel -> Maybe IngressAccessLogs)
-> (Channel -> Maybe IngressAccessLogs -> Channel)
-> Lens
     Channel Channel (Maybe IngressAccessLogs) (Maybe IngressAccessLogs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe IngressAccessLogs
ingressAccessLogs :: Maybe IngressAccessLogs
$sel:ingressAccessLogs:Channel' :: Channel -> Maybe IngressAccessLogs
ingressAccessLogs} -> Maybe IngressAccessLogs
ingressAccessLogs) (\s :: Channel
s@Channel' {} Maybe IngressAccessLogs
a -> Channel
s {$sel:ingressAccessLogs:Channel' :: Maybe IngressAccessLogs
ingressAccessLogs = Maybe IngressAccessLogs
a} :: Channel)

-- | Undocumented member.
channel_hlsIngest :: Lens.Lens' Channel (Prelude.Maybe HlsIngest)
channel_hlsIngest :: (Maybe HlsIngest -> f (Maybe HlsIngest)) -> Channel -> f Channel
channel_hlsIngest = (Channel -> Maybe HlsIngest)
-> (Channel -> Maybe HlsIngest -> Channel)
-> Lens Channel Channel (Maybe HlsIngest) (Maybe HlsIngest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe HlsIngest
hlsIngest :: Maybe HlsIngest
$sel:hlsIngest:Channel' :: Channel -> Maybe HlsIngest
hlsIngest} -> Maybe HlsIngest
hlsIngest) (\s :: Channel
s@Channel' {} Maybe HlsIngest
a -> Channel
s {$sel:hlsIngest:Channel' :: Maybe HlsIngest
hlsIngest = Maybe HlsIngest
a} :: Channel)

-- | The Amazon Resource Name (ARN) assigned to the Channel.
channel_arn :: Lens.Lens' Channel (Prelude.Maybe Prelude.Text)
channel_arn :: (Maybe Text -> f (Maybe Text)) -> Channel -> f Channel
channel_arn = (Channel -> Maybe Text)
-> (Channel -> Maybe Text -> Channel)
-> Lens Channel Channel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe Text
arn :: Maybe Text
$sel:arn:Channel' :: Channel -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Channel
s@Channel' {} Maybe Text
a -> Channel
s {$sel:arn:Channel' :: Maybe Text
arn = Maybe Text
a} :: Channel)

-- | The ID of the Channel.
channel_id :: Lens.Lens' Channel (Prelude.Maybe Prelude.Text)
channel_id :: (Maybe Text -> f (Maybe Text)) -> Channel -> f Channel
channel_id = (Channel -> Maybe Text)
-> (Channel -> Maybe Text -> Channel)
-> Lens Channel Channel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe Text
id :: Maybe Text
$sel:id:Channel' :: Channel -> Maybe Text
id} -> Maybe Text
id) (\s :: Channel
s@Channel' {} Maybe Text
a -> Channel
s {$sel:id:Channel' :: Maybe Text
id = Maybe Text
a} :: Channel)

-- | A short text description of the Channel.
channel_description :: Lens.Lens' Channel (Prelude.Maybe Prelude.Text)
channel_description :: (Maybe Text -> f (Maybe Text)) -> Channel -> f Channel
channel_description = (Channel -> Maybe Text)
-> (Channel -> Maybe Text -> Channel)
-> Lens Channel Channel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe Text
description :: Maybe Text
$sel:description:Channel' :: Channel -> Maybe Text
description} -> Maybe Text
description) (\s :: Channel
s@Channel' {} Maybe Text
a -> Channel
s {$sel:description:Channel' :: Maybe Text
description = Maybe Text
a} :: Channel)

-- | Undocumented member.
channel_egressAccessLogs :: Lens.Lens' Channel (Prelude.Maybe EgressAccessLogs)
channel_egressAccessLogs :: (Maybe EgressAccessLogs -> f (Maybe EgressAccessLogs))
-> Channel -> f Channel
channel_egressAccessLogs = (Channel -> Maybe EgressAccessLogs)
-> (Channel -> Maybe EgressAccessLogs -> Channel)
-> Lens
     Channel Channel (Maybe EgressAccessLogs) (Maybe EgressAccessLogs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe EgressAccessLogs
egressAccessLogs :: Maybe EgressAccessLogs
$sel:egressAccessLogs:Channel' :: Channel -> Maybe EgressAccessLogs
egressAccessLogs} -> Maybe EgressAccessLogs
egressAccessLogs) (\s :: Channel
s@Channel' {} Maybe EgressAccessLogs
a -> Channel
s {$sel:egressAccessLogs:Channel' :: Maybe EgressAccessLogs
egressAccessLogs = Maybe EgressAccessLogs
a} :: Channel)

-- | Undocumented member.
channel_tags :: Lens.Lens' Channel (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
channel_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Channel -> f Channel
channel_tags = (Channel -> Maybe (HashMap Text Text))
-> (Channel -> Maybe (HashMap Text Text) -> Channel)
-> Lens
     Channel
     Channel
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Channel' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Channel' :: Channel -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Channel
s@Channel' {} Maybe (HashMap Text Text)
a -> Channel
s {$sel:tags:Channel' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Channel) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Channel -> f Channel)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Channel
-> f Channel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Channel where
  parseJSON :: Value -> Parser Channel
parseJSON =
    String -> (Object -> Parser Channel) -> Value -> Parser Channel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Channel"
      ( \Object
x ->
          Maybe IngressAccessLogs
-> Maybe HlsIngest
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe EgressAccessLogs
-> Maybe (HashMap Text Text)
-> Channel
Channel'
            (Maybe IngressAccessLogs
 -> Maybe HlsIngest
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe EgressAccessLogs
 -> Maybe (HashMap Text Text)
 -> Channel)
-> Parser (Maybe IngressAccessLogs)
-> Parser
     (Maybe HlsIngest
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe EgressAccessLogs
      -> Maybe (HashMap Text Text)
      -> Channel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe IngressAccessLogs)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ingressAccessLogs")
            Parser
  (Maybe HlsIngest
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe EgressAccessLogs
   -> Maybe (HashMap Text Text)
   -> Channel)
-> Parser (Maybe HlsIngest)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe EgressAccessLogs
      -> Maybe (HashMap Text Text)
      -> Channel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HlsIngest)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"hlsIngest")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe EgressAccessLogs
   -> Maybe (HashMap Text Text)
   -> Channel)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe EgressAccessLogs
      -> Maybe (HashMap Text Text)
      -> Channel)
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
"arn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe EgressAccessLogs
   -> Maybe (HashMap Text Text)
   -> Channel)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe EgressAccessLogs -> Maybe (HashMap Text Text) -> Channel)
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
"id")
            Parser
  (Maybe Text
   -> Maybe EgressAccessLogs -> Maybe (HashMap Text Text) -> Channel)
-> Parser (Maybe Text)
-> Parser
     (Maybe EgressAccessLogs -> Maybe (HashMap Text Text) -> Channel)
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
"description")
            Parser
  (Maybe EgressAccessLogs -> Maybe (HashMap Text Text) -> Channel)
-> Parser (Maybe EgressAccessLogs)
-> Parser (Maybe (HashMap Text Text) -> Channel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EgressAccessLogs)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"egressAccessLogs")
            Parser (Maybe (HashMap Text Text) -> Channel)
-> Parser (Maybe (HashMap Text Text)) -> Parser Channel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Channel

instance Prelude.NFData Channel