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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(MonthlyTransfer -> MonthlyTransfer -> Bool)
-> (MonthlyTransfer -> MonthlyTransfer -> Bool)
-> Eq MonthlyTransfer
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]
(Int -> ReadS MonthlyTransfer)
-> ReadS [MonthlyTransfer]
-> ReadPrec MonthlyTransfer
-> ReadPrec [MonthlyTransfer]
-> Read 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
(Int -> MonthlyTransfer -> ShowS)
-> (MonthlyTransfer -> String)
-> ([MonthlyTransfer] -> ShowS)
-> Show MonthlyTransfer
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. MonthlyTransfer -> Rep MonthlyTransfer x)
-> (forall x. Rep MonthlyTransfer x -> MonthlyTransfer)
-> Generic MonthlyTransfer
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' :: Maybe Int -> MonthlyTransfer
MonthlyTransfer'
    { $sel:gbPerMonthAllocated:MonthlyTransfer' :: Maybe Int
gbPerMonthAllocated =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The amount allocated per month (in GB).
monthlyTransfer_gbPerMonthAllocated :: Lens.Lens' MonthlyTransfer (Prelude.Maybe Prelude.Int)
monthlyTransfer_gbPerMonthAllocated :: (Maybe Int -> f (Maybe Int))
-> MonthlyTransfer -> f MonthlyTransfer
monthlyTransfer_gbPerMonthAllocated = (MonthlyTransfer -> Maybe Int)
-> (MonthlyTransfer -> Maybe Int -> MonthlyTransfer)
-> Lens MonthlyTransfer MonthlyTransfer (Maybe Int) (Maybe Int)
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 Core.FromJSON MonthlyTransfer where
  parseJSON :: Value -> Parser MonthlyTransfer
parseJSON =
    String
-> (Object -> Parser MonthlyTransfer)
-> Value
-> Parser MonthlyTransfer
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MonthlyTransfer"
      ( \Object
x ->
          Maybe Int -> MonthlyTransfer
MonthlyTransfer'
            (Maybe Int -> MonthlyTransfer)
-> Parser (Maybe Int) -> Parser MonthlyTransfer
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
"gbPerMonthAllocated")
      )

instance Prelude.Hashable MonthlyTransfer

instance Prelude.NFData MonthlyTransfer