{-# 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 #-}
module Amazonka.MediaConnect.Types.Entitlement where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types.Encryption
import Amazonka.MediaConnect.Types.EntitlementStatus
import qualified Amazonka.Prelude as Prelude
data Entitlement = Entitlement'
{
Entitlement -> Maybe Int
dataTransferSubscriberFeePercent :: Prelude.Maybe Prelude.Int,
Entitlement -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
Entitlement -> Maybe EntitlementStatus
entitlementStatus :: Prelude.Maybe EntitlementStatus,
Entitlement -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
Entitlement -> Text
entitlementArn :: Prelude.Text,
Entitlement -> [Text]
subscribers :: [Prelude.Text],
Entitlement -> Text
name :: Prelude.Text
}
deriving (Entitlement -> Entitlement -> Bool
(Entitlement -> Entitlement -> Bool)
-> (Entitlement -> Entitlement -> Bool) -> Eq Entitlement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Entitlement -> Entitlement -> Bool
$c/= :: Entitlement -> Entitlement -> Bool
== :: Entitlement -> Entitlement -> Bool
$c== :: Entitlement -> Entitlement -> Bool
Prelude.Eq, ReadPrec [Entitlement]
ReadPrec Entitlement
Int -> ReadS Entitlement
ReadS [Entitlement]
(Int -> ReadS Entitlement)
-> ReadS [Entitlement]
-> ReadPrec Entitlement
-> ReadPrec [Entitlement]
-> Read Entitlement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Entitlement]
$creadListPrec :: ReadPrec [Entitlement]
readPrec :: ReadPrec Entitlement
$creadPrec :: ReadPrec Entitlement
readList :: ReadS [Entitlement]
$creadList :: ReadS [Entitlement]
readsPrec :: Int -> ReadS Entitlement
$creadsPrec :: Int -> ReadS Entitlement
Prelude.Read, Int -> Entitlement -> ShowS
[Entitlement] -> ShowS
Entitlement -> String
(Int -> Entitlement -> ShowS)
-> (Entitlement -> String)
-> ([Entitlement] -> ShowS)
-> Show Entitlement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Entitlement] -> ShowS
$cshowList :: [Entitlement] -> ShowS
show :: Entitlement -> String
$cshow :: Entitlement -> String
showsPrec :: Int -> Entitlement -> ShowS
$cshowsPrec :: Int -> Entitlement -> ShowS
Prelude.Show, (forall x. Entitlement -> Rep Entitlement x)
-> (forall x. Rep Entitlement x -> Entitlement)
-> Generic Entitlement
forall x. Rep Entitlement x -> Entitlement
forall x. Entitlement -> Rep Entitlement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Entitlement x -> Entitlement
$cfrom :: forall x. Entitlement -> Rep Entitlement x
Prelude.Generic)
newEntitlement ::
Prelude.Text ->
Prelude.Text ->
Entitlement
newEntitlement :: Text -> Text -> Entitlement
newEntitlement Text
pEntitlementArn_ Text
pName_ =
Entitlement' :: Maybe Int
-> Maybe Encryption
-> Maybe EntitlementStatus
-> Maybe Text
-> Text
-> [Text]
-> Text
-> Entitlement
Entitlement'
{ $sel:dataTransferSubscriberFeePercent:Entitlement' :: Maybe Int
dataTransferSubscriberFeePercent =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:encryption:Entitlement' :: Maybe Encryption
encryption = Maybe Encryption
forall a. Maybe a
Prelude.Nothing,
$sel:entitlementStatus:Entitlement' :: Maybe EntitlementStatus
entitlementStatus = Maybe EntitlementStatus
forall a. Maybe a
Prelude.Nothing,
$sel:description:Entitlement' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:entitlementArn:Entitlement' :: Text
entitlementArn = Text
pEntitlementArn_,
$sel:subscribers:Entitlement' :: [Text]
subscribers = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:name:Entitlement' :: Text
name = Text
pName_
}
entitlement_dataTransferSubscriberFeePercent :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.Int)
entitlement_dataTransferSubscriberFeePercent :: (Maybe Int -> f (Maybe Int)) -> Entitlement -> f Entitlement
entitlement_dataTransferSubscriberFeePercent = (Entitlement -> Maybe Int)
-> (Entitlement -> Maybe Int -> Entitlement)
-> Lens Entitlement Entitlement (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe Int
dataTransferSubscriberFeePercent :: Maybe Int
$sel:dataTransferSubscriberFeePercent:Entitlement' :: Entitlement -> Maybe Int
dataTransferSubscriberFeePercent} -> Maybe Int
dataTransferSubscriberFeePercent) (\s :: Entitlement
s@Entitlement' {} Maybe Int
a -> Entitlement
s {$sel:dataTransferSubscriberFeePercent:Entitlement' :: Maybe Int
dataTransferSubscriberFeePercent = Maybe Int
a} :: Entitlement)
entitlement_encryption :: Lens.Lens' Entitlement (Prelude.Maybe Encryption)
entitlement_encryption :: (Maybe Encryption -> f (Maybe Encryption))
-> Entitlement -> f Entitlement
entitlement_encryption = (Entitlement -> Maybe Encryption)
-> (Entitlement -> Maybe Encryption -> Entitlement)
-> Lens
Entitlement Entitlement (Maybe Encryption) (Maybe Encryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe Encryption
encryption :: Maybe Encryption
$sel:encryption:Entitlement' :: Entitlement -> Maybe Encryption
encryption} -> Maybe Encryption
encryption) (\s :: Entitlement
s@Entitlement' {} Maybe Encryption
a -> Entitlement
s {$sel:encryption:Entitlement' :: Maybe Encryption
encryption = Maybe Encryption
a} :: Entitlement)
entitlement_entitlementStatus :: Lens.Lens' Entitlement (Prelude.Maybe EntitlementStatus)
entitlement_entitlementStatus :: (Maybe EntitlementStatus -> f (Maybe EntitlementStatus))
-> Entitlement -> f Entitlement
entitlement_entitlementStatus = (Entitlement -> Maybe EntitlementStatus)
-> (Entitlement -> Maybe EntitlementStatus -> Entitlement)
-> Lens
Entitlement
Entitlement
(Maybe EntitlementStatus)
(Maybe EntitlementStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe EntitlementStatus
entitlementStatus :: Maybe EntitlementStatus
$sel:entitlementStatus:Entitlement' :: Entitlement -> Maybe EntitlementStatus
entitlementStatus} -> Maybe EntitlementStatus
entitlementStatus) (\s :: Entitlement
s@Entitlement' {} Maybe EntitlementStatus
a -> Entitlement
s {$sel:entitlementStatus:Entitlement' :: Maybe EntitlementStatus
entitlementStatus = Maybe EntitlementStatus
a} :: Entitlement)
entitlement_description :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.Text)
entitlement_description :: (Maybe Text -> f (Maybe Text)) -> Entitlement -> f Entitlement
entitlement_description = (Entitlement -> Maybe Text)
-> (Entitlement -> Maybe Text -> Entitlement)
-> Lens Entitlement Entitlement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe Text
description :: Maybe Text
$sel:description:Entitlement' :: Entitlement -> Maybe Text
description} -> Maybe Text
description) (\s :: Entitlement
s@Entitlement' {} Maybe Text
a -> Entitlement
s {$sel:description:Entitlement' :: Maybe Text
description = Maybe Text
a} :: Entitlement)
entitlement_entitlementArn :: Lens.Lens' Entitlement Prelude.Text
entitlement_entitlementArn :: (Text -> f Text) -> Entitlement -> f Entitlement
entitlement_entitlementArn = (Entitlement -> Text)
-> (Entitlement -> Text -> Entitlement)
-> Lens Entitlement Entitlement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Text
entitlementArn :: Text
$sel:entitlementArn:Entitlement' :: Entitlement -> Text
entitlementArn} -> Text
entitlementArn) (\s :: Entitlement
s@Entitlement' {} Text
a -> Entitlement
s {$sel:entitlementArn:Entitlement' :: Text
entitlementArn = Text
a} :: Entitlement)
entitlement_subscribers :: Lens.Lens' Entitlement [Prelude.Text]
entitlement_subscribers :: ([Text] -> f [Text]) -> Entitlement -> f Entitlement
entitlement_subscribers = (Entitlement -> [Text])
-> (Entitlement -> [Text] -> Entitlement)
-> Lens Entitlement Entitlement [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {[Text]
subscribers :: [Text]
$sel:subscribers:Entitlement' :: Entitlement -> [Text]
subscribers} -> [Text]
subscribers) (\s :: Entitlement
s@Entitlement' {} [Text]
a -> Entitlement
s {$sel:subscribers:Entitlement' :: [Text]
subscribers = [Text]
a} :: Entitlement) (([Text] -> f [Text]) -> Entitlement -> f Entitlement)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> Entitlement
-> f Entitlement
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
entitlement_name :: Lens.Lens' Entitlement Prelude.Text
entitlement_name :: (Text -> f Text) -> Entitlement -> f Entitlement
entitlement_name = (Entitlement -> Text)
-> (Entitlement -> Text -> Entitlement)
-> Lens Entitlement Entitlement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Text
name :: Text
$sel:name:Entitlement' :: Entitlement -> Text
name} -> Text
name) (\s :: Entitlement
s@Entitlement' {} Text
a -> Entitlement
s {$sel:name:Entitlement' :: Text
name = Text
a} :: Entitlement)
instance Core.FromJSON Entitlement where
parseJSON :: Value -> Parser Entitlement
parseJSON =
String
-> (Object -> Parser Entitlement) -> Value -> Parser Entitlement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Entitlement"
( \Object
x ->
Maybe Int
-> Maybe Encryption
-> Maybe EntitlementStatus
-> Maybe Text
-> Text
-> [Text]
-> Text
-> Entitlement
Entitlement'
(Maybe Int
-> Maybe Encryption
-> Maybe EntitlementStatus
-> Maybe Text
-> Text
-> [Text]
-> Text
-> Entitlement)
-> Parser (Maybe Int)
-> Parser
(Maybe Encryption
-> Maybe EntitlementStatus
-> Maybe Text
-> Text
-> [Text]
-> Text
-> Entitlement)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dataTransferSubscriberFeePercent")
Parser
(Maybe Encryption
-> Maybe EntitlementStatus
-> Maybe Text
-> Text
-> [Text]
-> Text
-> Entitlement)
-> Parser (Maybe Encryption)
-> Parser
(Maybe EntitlementStatus
-> Maybe Text -> Text -> [Text] -> Text -> Entitlement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Encryption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"encryption")
Parser
(Maybe EntitlementStatus
-> Maybe Text -> Text -> [Text] -> Text -> Entitlement)
-> Parser (Maybe EntitlementStatus)
-> Parser (Maybe Text -> Text -> [Text] -> Text -> Entitlement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntitlementStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"entitlementStatus")
Parser (Maybe Text -> Text -> [Text] -> Text -> Entitlement)
-> Parser (Maybe Text)
-> Parser (Text -> [Text] -> Text -> Entitlement)
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 (Text -> [Text] -> Text -> Entitlement)
-> Parser Text -> Parser ([Text] -> Text -> Entitlement)
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
"entitlementArn")
Parser ([Text] -> Text -> Entitlement)
-> Parser [Text] -> Parser (Text -> Entitlement)
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
"subscribers" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> Entitlement) -> Parser Text -> Parser Entitlement
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
"name")
)
instance Prelude.Hashable Entitlement
instance Prelude.NFData Entitlement