{-# 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.MonthlyTransfer
-- 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.MonthlyTransfer 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 monthly data transfer in and out of your virtual private
-- server (or /instance/).
--
-- /See:/ 'newMonthlyTransfer' smart constructor.
data MonthlyTransfer = MonthlyTransfer'
  { -- | The amount allocated per month (in GB).
    MonthlyTransfer -> Maybe Int
gbPerMonthAllocated :: Prelude.Maybe Prelude.Int
  }
  deriving (MonthlyTransfer -> MonthlyTransfer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonthlyTransfer -> MonthlyTransfer -> Bool
$c/= :: MonthlyTransfer -> MonthlyTransfer -> Bool
== :: MonthlyTransfer -> MonthlyTransfer -> Bool
$c== :: MonthlyTransfer -> MonthlyTransfer -> Bool
Prelude.Eq, ReadPrec [MonthlyTransfer]
ReadPrec MonthlyTransfer
Int -> ReadS MonthlyTransfer
ReadS [MonthlyTransfer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonthlyTransfer]
$creadListPrec :: ReadPrec [MonthlyTransfer]
readPrec :: ReadPrec MonthlyTransfer
$creadPrec :: ReadPrec MonthlyTransfer
readList :: ReadS [MonthlyTransfer]
$creadList :: ReadS [MonthlyTransfer]
readsPrec :: Int -> ReadS MonthlyTransfer
$creadsPrec :: Int -> ReadS MonthlyTransfer
Prelude.Read, Int -> MonthlyTransfer -> ShowS
[MonthlyTransfer] -> ShowS
MonthlyTransfer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonthlyTransfer] -> ShowS
$cshowList :: [MonthlyTransfer] -> ShowS
show :: MonthlyTransfer -> String
$cshow :: MonthlyTransfer -> String
showsPrec :: Int -> MonthlyTransfer -> ShowS
$cshowsPrec :: Int -> MonthlyTransfer -> ShowS
Prelude.Show, forall x. Rep MonthlyTransfer x -> MonthlyTransfer
forall x. MonthlyTransfer -> Rep MonthlyTransfer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MonthlyTransfer x -> MonthlyTransfer
$cfrom :: forall x. MonthlyTransfer -> Rep MonthlyTransfer x
Prelude.Generic)

-- |
-- Create a value of 'MonthlyTransfer' 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:
--
-- 'gbPerMonthAllocated', 'monthlyTransfer_gbPerMonthAllocated' - The amount allocated per month (in GB).
newMonthlyTransfer ::
  MonthlyTransfer
newMonthlyTransfer :: MonthlyTransfer
newMonthlyTransfer =
  MonthlyTransfer'
    { $sel:gbPerMonthAllocated:MonthlyTransfer' :: Maybe Int
gbPerMonthAllocated =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The amount allocated per month (in GB).
monthlyTransfer_gbPerMonthAllocated :: Lens.Lens' MonthlyTransfer (Prelude.Maybe Prelude.Int)
monthlyTransfer_gbPerMonthAllocated :: Lens' MonthlyTransfer (Maybe Int)
monthlyTransfer_gbPerMonthAllocated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonthlyTransfer' {Maybe Int
gbPerMonthAllocated :: Maybe Int
$sel:gbPerMonthAllocated:MonthlyTransfer' :: MonthlyTransfer -> Maybe Int
gbPerMonthAllocated} -> Maybe Int
gbPerMonthAllocated) (\s :: MonthlyTransfer
s@MonthlyTransfer' {} Maybe Int
a -> MonthlyTransfer
s {$sel:gbPerMonthAllocated:MonthlyTransfer' :: Maybe Int
gbPerMonthAllocated = Maybe Int
a} :: MonthlyTransfer)

instance Data.FromJSON MonthlyTransfer where
  parseJSON :: Value -> Parser MonthlyTransfer
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MonthlyTransfer"
      ( \Object
x ->
          Maybe Int -> MonthlyTransfer
MonthlyTransfer'
            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
"gbPerMonthAllocated")
      )

instance Prelude.Hashable MonthlyTransfer where
  hashWithSalt :: Int -> MonthlyTransfer -> Int
hashWithSalt Int
_salt MonthlyTransfer' {Maybe Int
gbPerMonthAllocated :: Maybe Int
$sel:gbPerMonthAllocated:MonthlyTransfer' :: MonthlyTransfer -> Maybe Int
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
gbPerMonthAllocated

instance Prelude.NFData MonthlyTransfer where
  rnf :: MonthlyTransfer -> ()
rnf MonthlyTransfer' {Maybe Int
gbPerMonthAllocated :: Maybe Int
$sel:gbPerMonthAllocated:MonthlyTransfer' :: MonthlyTransfer -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
gbPerMonthAllocated