{-# 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.MediaConvert.Types.ReservationPlan
-- 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.MediaConvert.Types.ReservationPlan where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.Commitment
import Amazonka.MediaConvert.Types.RenewalType
import Amazonka.MediaConvert.Types.ReservationPlanStatus
import qualified Amazonka.Prelude as Prelude

-- | Details about the pricing plan for your reserved queue. Required for
-- reserved queues and not applicable to on-demand queues.
--
-- /See:/ 'newReservationPlan' smart constructor.
data ReservationPlan = ReservationPlan'
  { -- | Specifies whether the pricing plan for your reserved queue is ACTIVE or
    -- EXPIRED.
    ReservationPlan -> Maybe ReservationPlanStatus
status :: Prelude.Maybe ReservationPlanStatus,
    -- | The timestamp in epoch seconds for when the current pricing plan term
    -- for this reserved queue expires.
    ReservationPlan -> Maybe POSIX
expiresAt :: Prelude.Maybe Core.POSIX,
    -- | The timestamp in epoch seconds for when you set up the current pricing
    -- plan for this reserved queue.
    ReservationPlan -> Maybe POSIX
purchasedAt :: Prelude.Maybe Core.POSIX,
    -- | The length of the term of your reserved queue pricing plan commitment.
    ReservationPlan -> Maybe Commitment
commitment :: Prelude.Maybe Commitment,
    -- | Specifies the number of reserved transcode slots (RTS) for this queue.
    -- The number of RTS determines how many jobs the queue can process in
    -- parallel; each RTS can process one job at a time. When you increase this
    -- number, you extend your existing commitment with a new 12-month
    -- commitment for a larger number of RTS. The new commitment begins when
    -- you purchase the additional capacity. You can\'t decrease the number of
    -- RTS in your reserved queue.
    ReservationPlan -> Maybe Int
reservedSlots :: Prelude.Maybe Prelude.Int,
    -- | Specifies whether the term of your reserved queue pricing plan is
    -- automatically extended (AUTO_RENEW) or expires (EXPIRE) at the end of
    -- the term.
    ReservationPlan -> Maybe RenewalType
renewalType :: Prelude.Maybe RenewalType
  }
  deriving (ReservationPlan -> ReservationPlan -> Bool
(ReservationPlan -> ReservationPlan -> Bool)
-> (ReservationPlan -> ReservationPlan -> Bool)
-> Eq ReservationPlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReservationPlan -> ReservationPlan -> Bool
$c/= :: ReservationPlan -> ReservationPlan -> Bool
== :: ReservationPlan -> ReservationPlan -> Bool
$c== :: ReservationPlan -> ReservationPlan -> Bool
Prelude.Eq, ReadPrec [ReservationPlan]
ReadPrec ReservationPlan
Int -> ReadS ReservationPlan
ReadS [ReservationPlan]
(Int -> ReadS ReservationPlan)
-> ReadS [ReservationPlan]
-> ReadPrec ReservationPlan
-> ReadPrec [ReservationPlan]
-> Read ReservationPlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReservationPlan]
$creadListPrec :: ReadPrec [ReservationPlan]
readPrec :: ReadPrec ReservationPlan
$creadPrec :: ReadPrec ReservationPlan
readList :: ReadS [ReservationPlan]
$creadList :: ReadS [ReservationPlan]
readsPrec :: Int -> ReadS ReservationPlan
$creadsPrec :: Int -> ReadS ReservationPlan
Prelude.Read, Int -> ReservationPlan -> ShowS
[ReservationPlan] -> ShowS
ReservationPlan -> String
(Int -> ReservationPlan -> ShowS)
-> (ReservationPlan -> String)
-> ([ReservationPlan] -> ShowS)
-> Show ReservationPlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReservationPlan] -> ShowS
$cshowList :: [ReservationPlan] -> ShowS
show :: ReservationPlan -> String
$cshow :: ReservationPlan -> String
showsPrec :: Int -> ReservationPlan -> ShowS
$cshowsPrec :: Int -> ReservationPlan -> ShowS
Prelude.Show, (forall x. ReservationPlan -> Rep ReservationPlan x)
-> (forall x. Rep ReservationPlan x -> ReservationPlan)
-> Generic ReservationPlan
forall x. Rep ReservationPlan x -> ReservationPlan
forall x. ReservationPlan -> Rep ReservationPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReservationPlan x -> ReservationPlan
$cfrom :: forall x. ReservationPlan -> Rep ReservationPlan x
Prelude.Generic)

-- |
-- Create a value of 'ReservationPlan' 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:
--
-- 'status', 'reservationPlan_status' - Specifies whether the pricing plan for your reserved queue is ACTIVE or
-- EXPIRED.
--
-- 'expiresAt', 'reservationPlan_expiresAt' - The timestamp in epoch seconds for when the current pricing plan term
-- for this reserved queue expires.
--
-- 'purchasedAt', 'reservationPlan_purchasedAt' - The timestamp in epoch seconds for when you set up the current pricing
-- plan for this reserved queue.
--
-- 'commitment', 'reservationPlan_commitment' - The length of the term of your reserved queue pricing plan commitment.
--
-- 'reservedSlots', 'reservationPlan_reservedSlots' - Specifies the number of reserved transcode slots (RTS) for this queue.
-- The number of RTS determines how many jobs the queue can process in
-- parallel; each RTS can process one job at a time. When you increase this
-- number, you extend your existing commitment with a new 12-month
-- commitment for a larger number of RTS. The new commitment begins when
-- you purchase the additional capacity. You can\'t decrease the number of
-- RTS in your reserved queue.
--
-- 'renewalType', 'reservationPlan_renewalType' - Specifies whether the term of your reserved queue pricing plan is
-- automatically extended (AUTO_RENEW) or expires (EXPIRE) at the end of
-- the term.
newReservationPlan ::
  ReservationPlan
newReservationPlan :: ReservationPlan
newReservationPlan =
  ReservationPlan' :: Maybe ReservationPlanStatus
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Commitment
-> Maybe Int
-> Maybe RenewalType
-> ReservationPlan
ReservationPlan'
    { $sel:status:ReservationPlan' :: Maybe ReservationPlanStatus
status = Maybe ReservationPlanStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:expiresAt:ReservationPlan' :: Maybe POSIX
expiresAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:purchasedAt:ReservationPlan' :: Maybe POSIX
purchasedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:commitment:ReservationPlan' :: Maybe Commitment
commitment = Maybe Commitment
forall a. Maybe a
Prelude.Nothing,
      $sel:reservedSlots:ReservationPlan' :: Maybe Int
reservedSlots = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:renewalType:ReservationPlan' :: Maybe RenewalType
renewalType = Maybe RenewalType
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether the pricing plan for your reserved queue is ACTIVE or
-- EXPIRED.
reservationPlan_status :: Lens.Lens' ReservationPlan (Prelude.Maybe ReservationPlanStatus)
reservationPlan_status :: (Maybe ReservationPlanStatus -> f (Maybe ReservationPlanStatus))
-> ReservationPlan -> f ReservationPlan
reservationPlan_status = (ReservationPlan -> Maybe ReservationPlanStatus)
-> (ReservationPlan
    -> Maybe ReservationPlanStatus -> ReservationPlan)
-> Lens
     ReservationPlan
     ReservationPlan
     (Maybe ReservationPlanStatus)
     (Maybe ReservationPlanStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlan' {Maybe ReservationPlanStatus
status :: Maybe ReservationPlanStatus
$sel:status:ReservationPlan' :: ReservationPlan -> Maybe ReservationPlanStatus
status} -> Maybe ReservationPlanStatus
status) (\s :: ReservationPlan
s@ReservationPlan' {} Maybe ReservationPlanStatus
a -> ReservationPlan
s {$sel:status:ReservationPlan' :: Maybe ReservationPlanStatus
status = Maybe ReservationPlanStatus
a} :: ReservationPlan)

-- | The timestamp in epoch seconds for when the current pricing plan term
-- for this reserved queue expires.
reservationPlan_expiresAt :: Lens.Lens' ReservationPlan (Prelude.Maybe Prelude.UTCTime)
reservationPlan_expiresAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReservationPlan -> f ReservationPlan
reservationPlan_expiresAt = (ReservationPlan -> Maybe POSIX)
-> (ReservationPlan -> Maybe POSIX -> ReservationPlan)
-> Lens ReservationPlan ReservationPlan (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlan' {Maybe POSIX
expiresAt :: Maybe POSIX
$sel:expiresAt:ReservationPlan' :: ReservationPlan -> Maybe POSIX
expiresAt} -> Maybe POSIX
expiresAt) (\s :: ReservationPlan
s@ReservationPlan' {} Maybe POSIX
a -> ReservationPlan
s {$sel:expiresAt:ReservationPlan' :: Maybe POSIX
expiresAt = Maybe POSIX
a} :: ReservationPlan) ((Maybe POSIX -> f (Maybe POSIX))
 -> ReservationPlan -> f ReservationPlan)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReservationPlan
-> f ReservationPlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The timestamp in epoch seconds for when you set up the current pricing
-- plan for this reserved queue.
reservationPlan_purchasedAt :: Lens.Lens' ReservationPlan (Prelude.Maybe Prelude.UTCTime)
reservationPlan_purchasedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReservationPlan -> f ReservationPlan
reservationPlan_purchasedAt = (ReservationPlan -> Maybe POSIX)
-> (ReservationPlan -> Maybe POSIX -> ReservationPlan)
-> Lens ReservationPlan ReservationPlan (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlan' {Maybe POSIX
purchasedAt :: Maybe POSIX
$sel:purchasedAt:ReservationPlan' :: ReservationPlan -> Maybe POSIX
purchasedAt} -> Maybe POSIX
purchasedAt) (\s :: ReservationPlan
s@ReservationPlan' {} Maybe POSIX
a -> ReservationPlan
s {$sel:purchasedAt:ReservationPlan' :: Maybe POSIX
purchasedAt = Maybe POSIX
a} :: ReservationPlan) ((Maybe POSIX -> f (Maybe POSIX))
 -> ReservationPlan -> f ReservationPlan)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReservationPlan
-> f ReservationPlan
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The length of the term of your reserved queue pricing plan commitment.
reservationPlan_commitment :: Lens.Lens' ReservationPlan (Prelude.Maybe Commitment)
reservationPlan_commitment :: (Maybe Commitment -> f (Maybe Commitment))
-> ReservationPlan -> f ReservationPlan
reservationPlan_commitment = (ReservationPlan -> Maybe Commitment)
-> (ReservationPlan -> Maybe Commitment -> ReservationPlan)
-> Lens
     ReservationPlan
     ReservationPlan
     (Maybe Commitment)
     (Maybe Commitment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlan' {Maybe Commitment
commitment :: Maybe Commitment
$sel:commitment:ReservationPlan' :: ReservationPlan -> Maybe Commitment
commitment} -> Maybe Commitment
commitment) (\s :: ReservationPlan
s@ReservationPlan' {} Maybe Commitment
a -> ReservationPlan
s {$sel:commitment:ReservationPlan' :: Maybe Commitment
commitment = Maybe Commitment
a} :: ReservationPlan)

-- | Specifies the number of reserved transcode slots (RTS) for this queue.
-- The number of RTS determines how many jobs the queue can process in
-- parallel; each RTS can process one job at a time. When you increase this
-- number, you extend your existing commitment with a new 12-month
-- commitment for a larger number of RTS. The new commitment begins when
-- you purchase the additional capacity. You can\'t decrease the number of
-- RTS in your reserved queue.
reservationPlan_reservedSlots :: Lens.Lens' ReservationPlan (Prelude.Maybe Prelude.Int)
reservationPlan_reservedSlots :: (Maybe Int -> f (Maybe Int))
-> ReservationPlan -> f ReservationPlan
reservationPlan_reservedSlots = (ReservationPlan -> Maybe Int)
-> (ReservationPlan -> Maybe Int -> ReservationPlan)
-> Lens ReservationPlan ReservationPlan (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlan' {Maybe Int
reservedSlots :: Maybe Int
$sel:reservedSlots:ReservationPlan' :: ReservationPlan -> Maybe Int
reservedSlots} -> Maybe Int
reservedSlots) (\s :: ReservationPlan
s@ReservationPlan' {} Maybe Int
a -> ReservationPlan
s {$sel:reservedSlots:ReservationPlan' :: Maybe Int
reservedSlots = Maybe Int
a} :: ReservationPlan)

-- | Specifies whether the term of your reserved queue pricing plan is
-- automatically extended (AUTO_RENEW) or expires (EXPIRE) at the end of
-- the term.
reservationPlan_renewalType :: Lens.Lens' ReservationPlan (Prelude.Maybe RenewalType)
reservationPlan_renewalType :: (Maybe RenewalType -> f (Maybe RenewalType))
-> ReservationPlan -> f ReservationPlan
reservationPlan_renewalType = (ReservationPlan -> Maybe RenewalType)
-> (ReservationPlan -> Maybe RenewalType -> ReservationPlan)
-> Lens
     ReservationPlan
     ReservationPlan
     (Maybe RenewalType)
     (Maybe RenewalType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlan' {Maybe RenewalType
renewalType :: Maybe RenewalType
$sel:renewalType:ReservationPlan' :: ReservationPlan -> Maybe RenewalType
renewalType} -> Maybe RenewalType
renewalType) (\s :: ReservationPlan
s@ReservationPlan' {} Maybe RenewalType
a -> ReservationPlan
s {$sel:renewalType:ReservationPlan' :: Maybe RenewalType
renewalType = Maybe RenewalType
a} :: ReservationPlan)

instance Core.FromJSON ReservationPlan where
  parseJSON :: Value -> Parser ReservationPlan
parseJSON =
    String
-> (Object -> Parser ReservationPlan)
-> Value
-> Parser ReservationPlan
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReservationPlan"
      ( \Object
x ->
          Maybe ReservationPlanStatus
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Commitment
-> Maybe Int
-> Maybe RenewalType
-> ReservationPlan
ReservationPlan'
            (Maybe ReservationPlanStatus
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe Commitment
 -> Maybe Int
 -> Maybe RenewalType
 -> ReservationPlan)
-> Parser (Maybe ReservationPlanStatus)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe Commitment
      -> Maybe Int
      -> Maybe RenewalType
      -> ReservationPlan)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ReservationPlanStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe Commitment
   -> Maybe Int
   -> Maybe RenewalType
   -> ReservationPlan)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Commitment
      -> Maybe Int
      -> Maybe RenewalType
      -> ReservationPlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"expiresAt")
            Parser
  (Maybe POSIX
   -> Maybe Commitment
   -> Maybe Int
   -> Maybe RenewalType
   -> ReservationPlan)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Commitment
      -> Maybe Int -> Maybe RenewalType -> ReservationPlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"purchasedAt")
            Parser
  (Maybe Commitment
   -> Maybe Int -> Maybe RenewalType -> ReservationPlan)
-> Parser (Maybe Commitment)
-> Parser (Maybe Int -> Maybe RenewalType -> ReservationPlan)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Commitment)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"commitment")
            Parser (Maybe Int -> Maybe RenewalType -> ReservationPlan)
-> Parser (Maybe Int)
-> Parser (Maybe RenewalType -> ReservationPlan)
forall (f :: * -> *) a b. Applicative f => 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
"reservedSlots")
            Parser (Maybe RenewalType -> ReservationPlan)
-> Parser (Maybe RenewalType) -> Parser ReservationPlan
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RenewalType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"renewalType")
      )

instance Prelude.Hashable ReservationPlan

instance Prelude.NFData ReservationPlan