{-# 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.Lightsail.Types.DistributionBundle
-- 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.Lightsail.Types.DistributionBundle where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the specifications of a distribution bundle.
--
-- /See:/ 'newDistributionBundle' smart constructor.
data DistributionBundle = DistributionBundle'
  { -- | The monthly network transfer quota of the bundle.
    DistributionBundle -> Maybe Int
transferPerMonthInGb :: Prelude.Maybe Prelude.Int,
    -- | The ID of the bundle.
    DistributionBundle -> Maybe Text
bundleId :: Prelude.Maybe Prelude.Text,
    -- | The name of the distribution bundle.
    DistributionBundle -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The monthly price, in US dollars, of the bundle.
    DistributionBundle -> Maybe Double
price :: Prelude.Maybe Prelude.Double,
    -- | Indicates whether the bundle is active, and can be specified for a new
    -- or existing distribution.
    DistributionBundle -> Maybe Bool
isActive :: Prelude.Maybe Prelude.Bool
  }
  deriving (DistributionBundle -> DistributionBundle -> Bool
(DistributionBundle -> DistributionBundle -> Bool)
-> (DistributionBundle -> DistributionBundle -> Bool)
-> Eq DistributionBundle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DistributionBundle -> DistributionBundle -> Bool
$c/= :: DistributionBundle -> DistributionBundle -> Bool
== :: DistributionBundle -> DistributionBundle -> Bool
$c== :: DistributionBundle -> DistributionBundle -> Bool
Prelude.Eq, ReadPrec [DistributionBundle]
ReadPrec DistributionBundle
Int -> ReadS DistributionBundle
ReadS [DistributionBundle]
(Int -> ReadS DistributionBundle)
-> ReadS [DistributionBundle]
-> ReadPrec DistributionBundle
-> ReadPrec [DistributionBundle]
-> Read DistributionBundle
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DistributionBundle]
$creadListPrec :: ReadPrec [DistributionBundle]
readPrec :: ReadPrec DistributionBundle
$creadPrec :: ReadPrec DistributionBundle
readList :: ReadS [DistributionBundle]
$creadList :: ReadS [DistributionBundle]
readsPrec :: Int -> ReadS DistributionBundle
$creadsPrec :: Int -> ReadS DistributionBundle
Prelude.Read, Int -> DistributionBundle -> ShowS
[DistributionBundle] -> ShowS
DistributionBundle -> String
(Int -> DistributionBundle -> ShowS)
-> (DistributionBundle -> String)
-> ([DistributionBundle] -> ShowS)
-> Show DistributionBundle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DistributionBundle] -> ShowS
$cshowList :: [DistributionBundle] -> ShowS
show :: DistributionBundle -> String
$cshow :: DistributionBundle -> String
showsPrec :: Int -> DistributionBundle -> ShowS
$cshowsPrec :: Int -> DistributionBundle -> ShowS
Prelude.Show, (forall x. DistributionBundle -> Rep DistributionBundle x)
-> (forall x. Rep DistributionBundle x -> DistributionBundle)
-> Generic DistributionBundle
forall x. Rep DistributionBundle x -> DistributionBundle
forall x. DistributionBundle -> Rep DistributionBundle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DistributionBundle x -> DistributionBundle
$cfrom :: forall x. DistributionBundle -> Rep DistributionBundle x
Prelude.Generic)

-- |
-- Create a value of 'DistributionBundle' 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:
--
-- 'transferPerMonthInGb', 'distributionBundle_transferPerMonthInGb' - The monthly network transfer quota of the bundle.
--
-- 'bundleId', 'distributionBundle_bundleId' - The ID of the bundle.
--
-- 'name', 'distributionBundle_name' - The name of the distribution bundle.
--
-- 'price', 'distributionBundle_price' - The monthly price, in US dollars, of the bundle.
--
-- 'isActive', 'distributionBundle_isActive' - Indicates whether the bundle is active, and can be specified for a new
-- or existing distribution.
newDistributionBundle ::
  DistributionBundle
newDistributionBundle :: DistributionBundle
newDistributionBundle =
  DistributionBundle' :: Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Bool
-> DistributionBundle
DistributionBundle'
    { $sel:transferPerMonthInGb:DistributionBundle' :: Maybe Int
transferPerMonthInGb =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:bundleId:DistributionBundle' :: Maybe Text
bundleId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DistributionBundle' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:price:DistributionBundle' :: Maybe Double
price = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:isActive:DistributionBundle' :: Maybe Bool
isActive = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The monthly network transfer quota of the bundle.
distributionBundle_transferPerMonthInGb :: Lens.Lens' DistributionBundle (Prelude.Maybe Prelude.Int)
distributionBundle_transferPerMonthInGb :: (Maybe Int -> f (Maybe Int))
-> DistributionBundle -> f DistributionBundle
distributionBundle_transferPerMonthInGb = (DistributionBundle -> Maybe Int)
-> (DistributionBundle -> Maybe Int -> DistributionBundle)
-> Lens
     DistributionBundle DistributionBundle (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionBundle' {Maybe Int
transferPerMonthInGb :: Maybe Int
$sel:transferPerMonthInGb:DistributionBundle' :: DistributionBundle -> Maybe Int
transferPerMonthInGb} -> Maybe Int
transferPerMonthInGb) (\s :: DistributionBundle
s@DistributionBundle' {} Maybe Int
a -> DistributionBundle
s {$sel:transferPerMonthInGb:DistributionBundle' :: Maybe Int
transferPerMonthInGb = Maybe Int
a} :: DistributionBundle)

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

-- | The name of the distribution bundle.
distributionBundle_name :: Lens.Lens' DistributionBundle (Prelude.Maybe Prelude.Text)
distributionBundle_name :: (Maybe Text -> f (Maybe Text))
-> DistributionBundle -> f DistributionBundle
distributionBundle_name = (DistributionBundle -> Maybe Text)
-> (DistributionBundle -> Maybe Text -> DistributionBundle)
-> Lens
     DistributionBundle DistributionBundle (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionBundle' {Maybe Text
name :: Maybe Text
$sel:name:DistributionBundle' :: DistributionBundle -> Maybe Text
name} -> Maybe Text
name) (\s :: DistributionBundle
s@DistributionBundle' {} Maybe Text
a -> DistributionBundle
s {$sel:name:DistributionBundle' :: Maybe Text
name = Maybe Text
a} :: DistributionBundle)

-- | The monthly price, in US dollars, of the bundle.
distributionBundle_price :: Lens.Lens' DistributionBundle (Prelude.Maybe Prelude.Double)
distributionBundle_price :: (Maybe Double -> f (Maybe Double))
-> DistributionBundle -> f DistributionBundle
distributionBundle_price = (DistributionBundle -> Maybe Double)
-> (DistributionBundle -> Maybe Double -> DistributionBundle)
-> Lens
     DistributionBundle DistributionBundle (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionBundle' {Maybe Double
price :: Maybe Double
$sel:price:DistributionBundle' :: DistributionBundle -> Maybe Double
price} -> Maybe Double
price) (\s :: DistributionBundle
s@DistributionBundle' {} Maybe Double
a -> DistributionBundle
s {$sel:price:DistributionBundle' :: Maybe Double
price = Maybe Double
a} :: DistributionBundle)

-- | Indicates whether the bundle is active, and can be specified for a new
-- or existing distribution.
distributionBundle_isActive :: Lens.Lens' DistributionBundle (Prelude.Maybe Prelude.Bool)
distributionBundle_isActive :: (Maybe Bool -> f (Maybe Bool))
-> DistributionBundle -> f DistributionBundle
distributionBundle_isActive = (DistributionBundle -> Maybe Bool)
-> (DistributionBundle -> Maybe Bool -> DistributionBundle)
-> Lens
     DistributionBundle DistributionBundle (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionBundle' {Maybe Bool
isActive :: Maybe Bool
$sel:isActive:DistributionBundle' :: DistributionBundle -> Maybe Bool
isActive} -> Maybe Bool
isActive) (\s :: DistributionBundle
s@DistributionBundle' {} Maybe Bool
a -> DistributionBundle
s {$sel:isActive:DistributionBundle' :: Maybe Bool
isActive = Maybe Bool
a} :: DistributionBundle)

instance Core.FromJSON DistributionBundle where
  parseJSON :: Value -> Parser DistributionBundle
parseJSON =
    String
-> (Object -> Parser DistributionBundle)
-> Value
-> Parser DistributionBundle
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DistributionBundle"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Bool
-> DistributionBundle
DistributionBundle'
            (Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Double
 -> Maybe Bool
 -> DistributionBundle)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Double -> Maybe Bool -> DistributionBundle)
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
"transferPerMonthInGb")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Double -> Maybe Bool -> DistributionBundle)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Double -> Maybe Bool -> DistributionBundle)
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
"bundleId")
            Parser
  (Maybe Text -> Maybe Double -> Maybe Bool -> DistributionBundle)
-> Parser (Maybe Text)
-> Parser (Maybe Double -> Maybe Bool -> DistributionBundle)
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
"name")
            Parser (Maybe Double -> Maybe Bool -> DistributionBundle)
-> Parser (Maybe Double)
-> Parser (Maybe Bool -> DistributionBundle)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"price")
            Parser (Maybe Bool -> DistributionBundle)
-> Parser (Maybe Bool) -> Parser DistributionBundle
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isActive")
      )

instance Prelude.Hashable DistributionBundle

instance Prelude.NFData DistributionBundle