{-# 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.MediaConnect.Types.GrantEntitlementRequest
-- 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.MediaConnect.Types.GrantEntitlementRequest 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

-- | The entitlements that you want to grant on a flow.
--
-- /See:/ 'newGrantEntitlementRequest' smart constructor.
data GrantEntitlementRequest = GrantEntitlementRequest'
  { -- | Percentage from 0-100 of the data transfer cost to be billed to the
    -- subscriber.
    GrantEntitlementRequest -> Maybe Int
dataTransferSubscriberFeePercent :: Prelude.Maybe Prelude.Int,
    -- | The type of encryption that will be used on the output that is
    -- associated with this entitlement.
    GrantEntitlementRequest -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
    -- | The name of the entitlement. This value must be unique within the
    -- current flow.
    GrantEntitlementRequest -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | An indication of whether the new entitlement should be enabled or
    -- disabled as soon as it is created. If you don’t specify the
    -- entitlementStatus field in your request, MediaConnect sets it to
    -- ENABLED.
    GrantEntitlementRequest -> Maybe EntitlementStatus
entitlementStatus :: Prelude.Maybe EntitlementStatus,
    -- | A description of the entitlement. This description appears only on the
    -- AWS Elemental MediaConnect console and will not be seen by the
    -- subscriber or end user.
    GrantEntitlementRequest -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The AWS account IDs that you want to share your content with. The
    -- receiving accounts (subscribers) will be allowed to create their own
    -- flows using your content as the source.
    GrantEntitlementRequest -> [Text]
subscribers :: [Prelude.Text]
  }
  deriving (GrantEntitlementRequest -> GrantEntitlementRequest -> Bool
(GrantEntitlementRequest -> GrantEntitlementRequest -> Bool)
-> (GrantEntitlementRequest -> GrantEntitlementRequest -> Bool)
-> Eq GrantEntitlementRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrantEntitlementRequest -> GrantEntitlementRequest -> Bool
$c/= :: GrantEntitlementRequest -> GrantEntitlementRequest -> Bool
== :: GrantEntitlementRequest -> GrantEntitlementRequest -> Bool
$c== :: GrantEntitlementRequest -> GrantEntitlementRequest -> Bool
Prelude.Eq, ReadPrec [GrantEntitlementRequest]
ReadPrec GrantEntitlementRequest
Int -> ReadS GrantEntitlementRequest
ReadS [GrantEntitlementRequest]
(Int -> ReadS GrantEntitlementRequest)
-> ReadS [GrantEntitlementRequest]
-> ReadPrec GrantEntitlementRequest
-> ReadPrec [GrantEntitlementRequest]
-> Read GrantEntitlementRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrantEntitlementRequest]
$creadListPrec :: ReadPrec [GrantEntitlementRequest]
readPrec :: ReadPrec GrantEntitlementRequest
$creadPrec :: ReadPrec GrantEntitlementRequest
readList :: ReadS [GrantEntitlementRequest]
$creadList :: ReadS [GrantEntitlementRequest]
readsPrec :: Int -> ReadS GrantEntitlementRequest
$creadsPrec :: Int -> ReadS GrantEntitlementRequest
Prelude.Read, Int -> GrantEntitlementRequest -> ShowS
[GrantEntitlementRequest] -> ShowS
GrantEntitlementRequest -> String
(Int -> GrantEntitlementRequest -> ShowS)
-> (GrantEntitlementRequest -> String)
-> ([GrantEntitlementRequest] -> ShowS)
-> Show GrantEntitlementRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrantEntitlementRequest] -> ShowS
$cshowList :: [GrantEntitlementRequest] -> ShowS
show :: GrantEntitlementRequest -> String
$cshow :: GrantEntitlementRequest -> String
showsPrec :: Int -> GrantEntitlementRequest -> ShowS
$cshowsPrec :: Int -> GrantEntitlementRequest -> ShowS
Prelude.Show, (forall x.
 GrantEntitlementRequest -> Rep GrantEntitlementRequest x)
-> (forall x.
    Rep GrantEntitlementRequest x -> GrantEntitlementRequest)
-> Generic GrantEntitlementRequest
forall x. Rep GrantEntitlementRequest x -> GrantEntitlementRequest
forall x. GrantEntitlementRequest -> Rep GrantEntitlementRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrantEntitlementRequest x -> GrantEntitlementRequest
$cfrom :: forall x. GrantEntitlementRequest -> Rep GrantEntitlementRequest x
Prelude.Generic)

-- |
-- Create a value of 'GrantEntitlementRequest' 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:
--
-- 'dataTransferSubscriberFeePercent', 'grantEntitlementRequest_dataTransferSubscriberFeePercent' - Percentage from 0-100 of the data transfer cost to be billed to the
-- subscriber.
--
-- 'encryption', 'grantEntitlementRequest_encryption' - The type of encryption that will be used on the output that is
-- associated with this entitlement.
--
-- 'name', 'grantEntitlementRequest_name' - The name of the entitlement. This value must be unique within the
-- current flow.
--
-- 'entitlementStatus', 'grantEntitlementRequest_entitlementStatus' - An indication of whether the new entitlement should be enabled or
-- disabled as soon as it is created. If you don’t specify the
-- entitlementStatus field in your request, MediaConnect sets it to
-- ENABLED.
--
-- 'description', 'grantEntitlementRequest_description' - A description of the entitlement. This description appears only on the
-- AWS Elemental MediaConnect console and will not be seen by the
-- subscriber or end user.
--
-- 'subscribers', 'grantEntitlementRequest_subscribers' - The AWS account IDs that you want to share your content with. The
-- receiving accounts (subscribers) will be allowed to create their own
-- flows using your content as the source.
newGrantEntitlementRequest ::
  GrantEntitlementRequest
newGrantEntitlementRequest :: GrantEntitlementRequest
newGrantEntitlementRequest =
  GrantEntitlementRequest' :: Maybe Int
-> Maybe Encryption
-> Maybe Text
-> Maybe EntitlementStatus
-> Maybe Text
-> [Text]
-> GrantEntitlementRequest
GrantEntitlementRequest'
    { $sel:dataTransferSubscriberFeePercent:GrantEntitlementRequest' :: Maybe Int
dataTransferSubscriberFeePercent =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:encryption:GrantEntitlementRequest' :: Maybe Encryption
encryption = Maybe Encryption
forall a. Maybe a
Prelude.Nothing,
      $sel:name:GrantEntitlementRequest' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:entitlementStatus:GrantEntitlementRequest' :: Maybe EntitlementStatus
entitlementStatus = Maybe EntitlementStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:description:GrantEntitlementRequest' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subscribers:GrantEntitlementRequest' :: [Text]
subscribers = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Percentage from 0-100 of the data transfer cost to be billed to the
-- subscriber.
grantEntitlementRequest_dataTransferSubscriberFeePercent :: Lens.Lens' GrantEntitlementRequest (Prelude.Maybe Prelude.Int)
grantEntitlementRequest_dataTransferSubscriberFeePercent :: (Maybe Int -> f (Maybe Int))
-> GrantEntitlementRequest -> f GrantEntitlementRequest
grantEntitlementRequest_dataTransferSubscriberFeePercent = (GrantEntitlementRequest -> Maybe Int)
-> (GrantEntitlementRequest
    -> Maybe Int -> GrantEntitlementRequest)
-> Lens
     GrantEntitlementRequest
     GrantEntitlementRequest
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantEntitlementRequest' {Maybe Int
dataTransferSubscriberFeePercent :: Maybe Int
$sel:dataTransferSubscriberFeePercent:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe Int
dataTransferSubscriberFeePercent} -> Maybe Int
dataTransferSubscriberFeePercent) (\s :: GrantEntitlementRequest
s@GrantEntitlementRequest' {} Maybe Int
a -> GrantEntitlementRequest
s {$sel:dataTransferSubscriberFeePercent:GrantEntitlementRequest' :: Maybe Int
dataTransferSubscriberFeePercent = Maybe Int
a} :: GrantEntitlementRequest)

-- | The type of encryption that will be used on the output that is
-- associated with this entitlement.
grantEntitlementRequest_encryption :: Lens.Lens' GrantEntitlementRequest (Prelude.Maybe Encryption)
grantEntitlementRequest_encryption :: (Maybe Encryption -> f (Maybe Encryption))
-> GrantEntitlementRequest -> f GrantEntitlementRequest
grantEntitlementRequest_encryption = (GrantEntitlementRequest -> Maybe Encryption)
-> (GrantEntitlementRequest
    -> Maybe Encryption -> GrantEntitlementRequest)
-> Lens
     GrantEntitlementRequest
     GrantEntitlementRequest
     (Maybe Encryption)
     (Maybe Encryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantEntitlementRequest' {Maybe Encryption
encryption :: Maybe Encryption
$sel:encryption:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe Encryption
encryption} -> Maybe Encryption
encryption) (\s :: GrantEntitlementRequest
s@GrantEntitlementRequest' {} Maybe Encryption
a -> GrantEntitlementRequest
s {$sel:encryption:GrantEntitlementRequest' :: Maybe Encryption
encryption = Maybe Encryption
a} :: GrantEntitlementRequest)

-- | The name of the entitlement. This value must be unique within the
-- current flow.
grantEntitlementRequest_name :: Lens.Lens' GrantEntitlementRequest (Prelude.Maybe Prelude.Text)
grantEntitlementRequest_name :: (Maybe Text -> f (Maybe Text))
-> GrantEntitlementRequest -> f GrantEntitlementRequest
grantEntitlementRequest_name = (GrantEntitlementRequest -> Maybe Text)
-> (GrantEntitlementRequest
    -> Maybe Text -> GrantEntitlementRequest)
-> Lens
     GrantEntitlementRequest
     GrantEntitlementRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantEntitlementRequest' {Maybe Text
name :: Maybe Text
$sel:name:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe Text
name} -> Maybe Text
name) (\s :: GrantEntitlementRequest
s@GrantEntitlementRequest' {} Maybe Text
a -> GrantEntitlementRequest
s {$sel:name:GrantEntitlementRequest' :: Maybe Text
name = Maybe Text
a} :: GrantEntitlementRequest)

-- | An indication of whether the new entitlement should be enabled or
-- disabled as soon as it is created. If you don’t specify the
-- entitlementStatus field in your request, MediaConnect sets it to
-- ENABLED.
grantEntitlementRequest_entitlementStatus :: Lens.Lens' GrantEntitlementRequest (Prelude.Maybe EntitlementStatus)
grantEntitlementRequest_entitlementStatus :: (Maybe EntitlementStatus -> f (Maybe EntitlementStatus))
-> GrantEntitlementRequest -> f GrantEntitlementRequest
grantEntitlementRequest_entitlementStatus = (GrantEntitlementRequest -> Maybe EntitlementStatus)
-> (GrantEntitlementRequest
    -> Maybe EntitlementStatus -> GrantEntitlementRequest)
-> Lens
     GrantEntitlementRequest
     GrantEntitlementRequest
     (Maybe EntitlementStatus)
     (Maybe EntitlementStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantEntitlementRequest' {Maybe EntitlementStatus
entitlementStatus :: Maybe EntitlementStatus
$sel:entitlementStatus:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe EntitlementStatus
entitlementStatus} -> Maybe EntitlementStatus
entitlementStatus) (\s :: GrantEntitlementRequest
s@GrantEntitlementRequest' {} Maybe EntitlementStatus
a -> GrantEntitlementRequest
s {$sel:entitlementStatus:GrantEntitlementRequest' :: Maybe EntitlementStatus
entitlementStatus = Maybe EntitlementStatus
a} :: GrantEntitlementRequest)

-- | A description of the entitlement. This description appears only on the
-- AWS Elemental MediaConnect console and will not be seen by the
-- subscriber or end user.
grantEntitlementRequest_description :: Lens.Lens' GrantEntitlementRequest (Prelude.Maybe Prelude.Text)
grantEntitlementRequest_description :: (Maybe Text -> f (Maybe Text))
-> GrantEntitlementRequest -> f GrantEntitlementRequest
grantEntitlementRequest_description = (GrantEntitlementRequest -> Maybe Text)
-> (GrantEntitlementRequest
    -> Maybe Text -> GrantEntitlementRequest)
-> Lens
     GrantEntitlementRequest
     GrantEntitlementRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantEntitlementRequest' {Maybe Text
description :: Maybe Text
$sel:description:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe Text
description} -> Maybe Text
description) (\s :: GrantEntitlementRequest
s@GrantEntitlementRequest' {} Maybe Text
a -> GrantEntitlementRequest
s {$sel:description:GrantEntitlementRequest' :: Maybe Text
description = Maybe Text
a} :: GrantEntitlementRequest)

-- | The AWS account IDs that you want to share your content with. The
-- receiving accounts (subscribers) will be allowed to create their own
-- flows using your content as the source.
grantEntitlementRequest_subscribers :: Lens.Lens' GrantEntitlementRequest [Prelude.Text]
grantEntitlementRequest_subscribers :: ([Text] -> f [Text])
-> GrantEntitlementRequest -> f GrantEntitlementRequest
grantEntitlementRequest_subscribers = (GrantEntitlementRequest -> [Text])
-> (GrantEntitlementRequest -> [Text] -> GrantEntitlementRequest)
-> Lens
     GrantEntitlementRequest GrantEntitlementRequest [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantEntitlementRequest' {[Text]
subscribers :: [Text]
$sel:subscribers:GrantEntitlementRequest' :: GrantEntitlementRequest -> [Text]
subscribers} -> [Text]
subscribers) (\s :: GrantEntitlementRequest
s@GrantEntitlementRequest' {} [Text]
a -> GrantEntitlementRequest
s {$sel:subscribers:GrantEntitlementRequest' :: [Text]
subscribers = [Text]
a} :: GrantEntitlementRequest) (([Text] -> f [Text])
 -> GrantEntitlementRequest -> f GrantEntitlementRequest)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GrantEntitlementRequest
-> f GrantEntitlementRequest
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

instance Prelude.Hashable GrantEntitlementRequest

instance Prelude.NFData GrantEntitlementRequest

instance Core.ToJSON GrantEntitlementRequest where
  toJSON :: GrantEntitlementRequest -> Value
toJSON GrantEntitlementRequest' {[Text]
Maybe Int
Maybe Text
Maybe EntitlementStatus
Maybe Encryption
subscribers :: [Text]
description :: Maybe Text
entitlementStatus :: Maybe EntitlementStatus
name :: Maybe Text
encryption :: Maybe Encryption
dataTransferSubscriberFeePercent :: Maybe Int
$sel:subscribers:GrantEntitlementRequest' :: GrantEntitlementRequest -> [Text]
$sel:description:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe Text
$sel:entitlementStatus:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe EntitlementStatus
$sel:name:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe Text
$sel:encryption:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe Encryption
$sel:dataTransferSubscriberFeePercent:GrantEntitlementRequest' :: GrantEntitlementRequest -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"dataTransferSubscriberFeePercent" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
dataTransferSubscriberFeePercent,
            (Text
"encryption" Text -> Encryption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Encryption -> Pair) -> Maybe Encryption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Encryption
encryption,
            (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"entitlementStatus" Text -> EntitlementStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EntitlementStatus -> Pair)
-> Maybe EntitlementStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EntitlementStatus
entitlementStatus,
            (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"subscribers" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
subscribers)
          ]
      )