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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types.DurationUnits
import Amazonka.MediaConnect.Types.PriceUnits
import Amazonka.MediaConnect.Types.ResourceSpecification
import qualified Amazonka.Prelude as Prelude

-- | A savings plan that reserves a certain amount of outbound bandwidth
-- usage at a discounted rate each month over a period of time.
--
-- /See:/ 'newOffering' smart constructor.
data Offering = Offering'
  { -- | The type of currency that is used for billing. The currencyCode used for
    -- all reservations is US dollars.
    Offering -> Text
currencyCode :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) that MediaConnect assigns to the
    -- offering.
    Offering -> Text
offeringArn :: Prelude.Text,
    -- | A description of the offering.
    Offering -> Text
offeringDescription :: Prelude.Text,
    -- | The unit of measurement for the duration of the offering.
    Offering -> DurationUnits
durationUnits :: DurationUnits,
    -- | The length of time that your reservation would be active.
    Offering -> Int
duration :: Prelude.Int,
    -- | The cost of a single unit. This value, in combination with priceUnits,
    -- makes up the rate.
    Offering -> Text
pricePerUnit :: Prelude.Text,
    -- | A definition of the amount of outbound bandwidth that you would be
    -- reserving if you purchase the offering.
    Offering -> ResourceSpecification
resourceSpecification :: ResourceSpecification,
    -- | The unit of measurement that is used for billing. This value, in
    -- combination with pricePerUnit, makes up the rate.
    Offering -> PriceUnits
priceUnits :: PriceUnits
  }
  deriving (Offering -> Offering -> Bool
(Offering -> Offering -> Bool)
-> (Offering -> Offering -> Bool) -> Eq Offering
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Offering -> Offering -> Bool
$c/= :: Offering -> Offering -> Bool
== :: Offering -> Offering -> Bool
$c== :: Offering -> Offering -> Bool
Prelude.Eq, ReadPrec [Offering]
ReadPrec Offering
Int -> ReadS Offering
ReadS [Offering]
(Int -> ReadS Offering)
-> ReadS [Offering]
-> ReadPrec Offering
-> ReadPrec [Offering]
-> Read Offering
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Offering]
$creadListPrec :: ReadPrec [Offering]
readPrec :: ReadPrec Offering
$creadPrec :: ReadPrec Offering
readList :: ReadS [Offering]
$creadList :: ReadS [Offering]
readsPrec :: Int -> ReadS Offering
$creadsPrec :: Int -> ReadS Offering
Prelude.Read, Int -> Offering -> ShowS
[Offering] -> ShowS
Offering -> String
(Int -> Offering -> ShowS)
-> (Offering -> String) -> ([Offering] -> ShowS) -> Show Offering
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Offering] -> ShowS
$cshowList :: [Offering] -> ShowS
show :: Offering -> String
$cshow :: Offering -> String
showsPrec :: Int -> Offering -> ShowS
$cshowsPrec :: Int -> Offering -> ShowS
Prelude.Show, (forall x. Offering -> Rep Offering x)
-> (forall x. Rep Offering x -> Offering) -> Generic Offering
forall x. Rep Offering x -> Offering
forall x. Offering -> Rep Offering x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Offering x -> Offering
$cfrom :: forall x. Offering -> Rep Offering x
Prelude.Generic)

-- |
-- Create a value of 'Offering' 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:
--
-- 'currencyCode', 'offering_currencyCode' - The type of currency that is used for billing. The currencyCode used for
-- all reservations is US dollars.
--
-- 'offeringArn', 'offering_offeringArn' - The Amazon Resource Name (ARN) that MediaConnect assigns to the
-- offering.
--
-- 'offeringDescription', 'offering_offeringDescription' - A description of the offering.
--
-- 'durationUnits', 'offering_durationUnits' - The unit of measurement for the duration of the offering.
--
-- 'duration', 'offering_duration' - The length of time that your reservation would be active.
--
-- 'pricePerUnit', 'offering_pricePerUnit' - The cost of a single unit. This value, in combination with priceUnits,
-- makes up the rate.
--
-- 'resourceSpecification', 'offering_resourceSpecification' - A definition of the amount of outbound bandwidth that you would be
-- reserving if you purchase the offering.
--
-- 'priceUnits', 'offering_priceUnits' - The unit of measurement that is used for billing. This value, in
-- combination with pricePerUnit, makes up the rate.
newOffering ::
  -- | 'currencyCode'
  Prelude.Text ->
  -- | 'offeringArn'
  Prelude.Text ->
  -- | 'offeringDescription'
  Prelude.Text ->
  -- | 'durationUnits'
  DurationUnits ->
  -- | 'duration'
  Prelude.Int ->
  -- | 'pricePerUnit'
  Prelude.Text ->
  -- | 'resourceSpecification'
  ResourceSpecification ->
  -- | 'priceUnits'
  PriceUnits ->
  Offering
newOffering :: Text
-> Text
-> Text
-> DurationUnits
-> Int
-> Text
-> ResourceSpecification
-> PriceUnits
-> Offering
newOffering
  Text
pCurrencyCode_
  Text
pOfferingArn_
  Text
pOfferingDescription_
  DurationUnits
pDurationUnits_
  Int
pDuration_
  Text
pPricePerUnit_
  ResourceSpecification
pResourceSpecification_
  PriceUnits
pPriceUnits_ =
    Offering' :: Text
-> Text
-> Text
-> DurationUnits
-> Int
-> Text
-> ResourceSpecification
-> PriceUnits
-> Offering
Offering'
      { $sel:currencyCode:Offering' :: Text
currencyCode = Text
pCurrencyCode_,
        $sel:offeringArn:Offering' :: Text
offeringArn = Text
pOfferingArn_,
        $sel:offeringDescription:Offering' :: Text
offeringDescription = Text
pOfferingDescription_,
        $sel:durationUnits:Offering' :: DurationUnits
durationUnits = DurationUnits
pDurationUnits_,
        $sel:duration:Offering' :: Int
duration = Int
pDuration_,
        $sel:pricePerUnit:Offering' :: Text
pricePerUnit = Text
pPricePerUnit_,
        $sel:resourceSpecification:Offering' :: ResourceSpecification
resourceSpecification = ResourceSpecification
pResourceSpecification_,
        $sel:priceUnits:Offering' :: PriceUnits
priceUnits = PriceUnits
pPriceUnits_
      }

-- | The type of currency that is used for billing. The currencyCode used for
-- all reservations is US dollars.
offering_currencyCode :: Lens.Lens' Offering Prelude.Text
offering_currencyCode :: (Text -> f Text) -> Offering -> f Offering
offering_currencyCode = (Offering -> Text)
-> (Offering -> Text -> Offering)
-> Lens Offering Offering Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Text
currencyCode :: Text
$sel:currencyCode:Offering' :: Offering -> Text
currencyCode} -> Text
currencyCode) (\s :: Offering
s@Offering' {} Text
a -> Offering
s {$sel:currencyCode:Offering' :: Text
currencyCode = Text
a} :: Offering)

-- | The Amazon Resource Name (ARN) that MediaConnect assigns to the
-- offering.
offering_offeringArn :: Lens.Lens' Offering Prelude.Text
offering_offeringArn :: (Text -> f Text) -> Offering -> f Offering
offering_offeringArn = (Offering -> Text)
-> (Offering -> Text -> Offering)
-> Lens Offering Offering Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Text
offeringArn :: Text
$sel:offeringArn:Offering' :: Offering -> Text
offeringArn} -> Text
offeringArn) (\s :: Offering
s@Offering' {} Text
a -> Offering
s {$sel:offeringArn:Offering' :: Text
offeringArn = Text
a} :: Offering)

-- | A description of the offering.
offering_offeringDescription :: Lens.Lens' Offering Prelude.Text
offering_offeringDescription :: (Text -> f Text) -> Offering -> f Offering
offering_offeringDescription = (Offering -> Text)
-> (Offering -> Text -> Offering)
-> Lens Offering Offering Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Text
offeringDescription :: Text
$sel:offeringDescription:Offering' :: Offering -> Text
offeringDescription} -> Text
offeringDescription) (\s :: Offering
s@Offering' {} Text
a -> Offering
s {$sel:offeringDescription:Offering' :: Text
offeringDescription = Text
a} :: Offering)

-- | The unit of measurement for the duration of the offering.
offering_durationUnits :: Lens.Lens' Offering DurationUnits
offering_durationUnits :: (DurationUnits -> f DurationUnits) -> Offering -> f Offering
offering_durationUnits = (Offering -> DurationUnits)
-> (Offering -> DurationUnits -> Offering)
-> Lens Offering Offering DurationUnits DurationUnits
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {DurationUnits
durationUnits :: DurationUnits
$sel:durationUnits:Offering' :: Offering -> DurationUnits
durationUnits} -> DurationUnits
durationUnits) (\s :: Offering
s@Offering' {} DurationUnits
a -> Offering
s {$sel:durationUnits:Offering' :: DurationUnits
durationUnits = DurationUnits
a} :: Offering)

-- | The length of time that your reservation would be active.
offering_duration :: Lens.Lens' Offering Prelude.Int
offering_duration :: (Int -> f Int) -> Offering -> f Offering
offering_duration = (Offering -> Int)
-> (Offering -> Int -> Offering) -> Lens Offering Offering Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Int
duration :: Int
$sel:duration:Offering' :: Offering -> Int
duration} -> Int
duration) (\s :: Offering
s@Offering' {} Int
a -> Offering
s {$sel:duration:Offering' :: Int
duration = Int
a} :: Offering)

-- | The cost of a single unit. This value, in combination with priceUnits,
-- makes up the rate.
offering_pricePerUnit :: Lens.Lens' Offering Prelude.Text
offering_pricePerUnit :: (Text -> f Text) -> Offering -> f Offering
offering_pricePerUnit = (Offering -> Text)
-> (Offering -> Text -> Offering)
-> Lens Offering Offering Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {Text
pricePerUnit :: Text
$sel:pricePerUnit:Offering' :: Offering -> Text
pricePerUnit} -> Text
pricePerUnit) (\s :: Offering
s@Offering' {} Text
a -> Offering
s {$sel:pricePerUnit:Offering' :: Text
pricePerUnit = Text
a} :: Offering)

-- | A definition of the amount of outbound bandwidth that you would be
-- reserving if you purchase the offering.
offering_resourceSpecification :: Lens.Lens' Offering ResourceSpecification
offering_resourceSpecification :: (ResourceSpecification -> f ResourceSpecification)
-> Offering -> f Offering
offering_resourceSpecification = (Offering -> ResourceSpecification)
-> (Offering -> ResourceSpecification -> Offering)
-> Lens
     Offering Offering ResourceSpecification ResourceSpecification
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {ResourceSpecification
resourceSpecification :: ResourceSpecification
$sel:resourceSpecification:Offering' :: Offering -> ResourceSpecification
resourceSpecification} -> ResourceSpecification
resourceSpecification) (\s :: Offering
s@Offering' {} ResourceSpecification
a -> Offering
s {$sel:resourceSpecification:Offering' :: ResourceSpecification
resourceSpecification = ResourceSpecification
a} :: Offering)

-- | The unit of measurement that is used for billing. This value, in
-- combination with pricePerUnit, makes up the rate.
offering_priceUnits :: Lens.Lens' Offering PriceUnits
offering_priceUnits :: (PriceUnits -> f PriceUnits) -> Offering -> f Offering
offering_priceUnits = (Offering -> PriceUnits)
-> (Offering -> PriceUnits -> Offering)
-> Lens Offering Offering PriceUnits PriceUnits
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Offering' {PriceUnits
priceUnits :: PriceUnits
$sel:priceUnits:Offering' :: Offering -> PriceUnits
priceUnits} -> PriceUnits
priceUnits) (\s :: Offering
s@Offering' {} PriceUnits
a -> Offering
s {$sel:priceUnits:Offering' :: PriceUnits
priceUnits = PriceUnits
a} :: Offering)

instance Core.FromJSON Offering where
  parseJSON :: Value -> Parser Offering
parseJSON =
    String -> (Object -> Parser Offering) -> Value -> Parser Offering
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Offering"
      ( \Object
x ->
          Text
-> Text
-> Text
-> DurationUnits
-> Int
-> Text
-> ResourceSpecification
-> PriceUnits
-> Offering
Offering'
            (Text
 -> Text
 -> Text
 -> DurationUnits
 -> Int
 -> Text
 -> ResourceSpecification
 -> PriceUnits
 -> Offering)
-> Parser Text
-> Parser
     (Text
      -> Text
      -> DurationUnits
      -> Int
      -> Text
      -> ResourceSpecification
      -> PriceUnits
      -> Offering)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"currencyCode")
            Parser
  (Text
   -> Text
   -> DurationUnits
   -> Int
   -> Text
   -> ResourceSpecification
   -> PriceUnits
   -> Offering)
-> Parser Text
-> Parser
     (Text
      -> DurationUnits
      -> Int
      -> Text
      -> ResourceSpecification
      -> PriceUnits
      -> Offering)
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
"offeringArn")
            Parser
  (Text
   -> DurationUnits
   -> Int
   -> Text
   -> ResourceSpecification
   -> PriceUnits
   -> Offering)
-> Parser Text
-> Parser
     (DurationUnits
      -> Int -> Text -> ResourceSpecification -> PriceUnits -> Offering)
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
"offeringDescription")
            Parser
  (DurationUnits
   -> Int -> Text -> ResourceSpecification -> PriceUnits -> Offering)
-> Parser DurationUnits
-> Parser
     (Int -> Text -> ResourceSpecification -> PriceUnits -> Offering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DurationUnits
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"durationUnits")
            Parser
  (Int -> Text -> ResourceSpecification -> PriceUnits -> Offering)
-> Parser Int
-> Parser (Text -> ResourceSpecification -> PriceUnits -> Offering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"duration")
            Parser (Text -> ResourceSpecification -> PriceUnits -> Offering)
-> Parser Text
-> Parser (ResourceSpecification -> PriceUnits -> Offering)
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
"pricePerUnit")
            Parser (ResourceSpecification -> PriceUnits -> Offering)
-> Parser ResourceSpecification -> Parser (PriceUnits -> Offering)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ResourceSpecification
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceSpecification")
            Parser (PriceUnits -> Offering)
-> Parser PriceUnits -> Parser Offering
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PriceUnits
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"priceUnits")
      )

instance Prelude.Hashable Offering

instance Prelude.NFData Offering