{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.DistributionBundle where

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

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

-- | The ID of the bundle.
distributionBundle_bundleId :: Lens.Lens' DistributionBundle (Prelude.Maybe Prelude.Text)
distributionBundle_bundleId :: Lens' DistributionBundle (Maybe Text)
distributionBundle_bundleId = 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)

-- | 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 :: Lens' DistributionBundle (Maybe Bool)
distributionBundle_isActive = 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)

-- | The name of the distribution bundle.
distributionBundle_name :: Lens.Lens' DistributionBundle (Prelude.Maybe Prelude.Text)
distributionBundle_name :: Lens' DistributionBundle (Maybe Text)
distributionBundle_name = 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 :: Lens' DistributionBundle (Maybe Double)
distributionBundle_price = 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)

-- | The monthly network transfer quota of the bundle.
distributionBundle_transferPerMonthInGb :: Lens.Lens' DistributionBundle (Prelude.Maybe Prelude.Int)
distributionBundle_transferPerMonthInGb :: Lens' DistributionBundle (Maybe Int)
distributionBundle_transferPerMonthInGb = 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)

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

instance Prelude.Hashable DistributionBundle where
  hashWithSalt :: Int -> DistributionBundle -> Int
hashWithSalt Int
_salt DistributionBundle' {Maybe Bool
Maybe Double
Maybe Int
Maybe Text
transferPerMonthInGb :: Maybe Int
price :: Maybe Double
name :: Maybe Text
isActive :: Maybe Bool
bundleId :: Maybe Text
$sel:transferPerMonthInGb:DistributionBundle' :: DistributionBundle -> Maybe Int
$sel:price:DistributionBundle' :: DistributionBundle -> Maybe Double
$sel:name:DistributionBundle' :: DistributionBundle -> Maybe Text
$sel:isActive:DistributionBundle' :: DistributionBundle -> Maybe Bool
$sel:bundleId:DistributionBundle' :: DistributionBundle -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
bundleId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isActive
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
price
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
transferPerMonthInGb

instance Prelude.NFData DistributionBundle where
  rnf :: DistributionBundle -> ()
rnf DistributionBundle' {Maybe Bool
Maybe Double
Maybe Int
Maybe Text
transferPerMonthInGb :: Maybe Int
price :: Maybe Double
name :: Maybe Text
isActive :: Maybe Bool
bundleId :: Maybe Text
$sel:transferPerMonthInGb:DistributionBundle' :: DistributionBundle -> Maybe Int
$sel:price:DistributionBundle' :: DistributionBundle -> Maybe Double
$sel:name:DistributionBundle' :: DistributionBundle -> Maybe Text
$sel:isActive:DistributionBundle' :: DistributionBundle -> Maybe Bool
$sel:bundleId:DistributionBundle' :: DistributionBundle -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
bundleId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isActive
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
price
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
transferPerMonthInGb