{-# 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.BillingConductor.Types.UpdateTieringInput
-- 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.BillingConductor.Types.UpdateTieringInput where

import Amazonka.BillingConductor.Types.UpdateFreeTierConfig
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

-- | The set of tiering configurations for the pricing rule.
--
-- /See:/ 'newUpdateTieringInput' smart constructor.
data UpdateTieringInput = UpdateTieringInput'
  { -- | The possible Amazon Web Services Free Tier configurations.
    UpdateTieringInput -> UpdateFreeTierConfig
freeTier :: UpdateFreeTierConfig
  }
  deriving (UpdateTieringInput -> UpdateTieringInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTieringInput -> UpdateTieringInput -> Bool
$c/= :: UpdateTieringInput -> UpdateTieringInput -> Bool
== :: UpdateTieringInput -> UpdateTieringInput -> Bool
$c== :: UpdateTieringInput -> UpdateTieringInput -> Bool
Prelude.Eq, ReadPrec [UpdateTieringInput]
ReadPrec UpdateTieringInput
Int -> ReadS UpdateTieringInput
ReadS [UpdateTieringInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTieringInput]
$creadListPrec :: ReadPrec [UpdateTieringInput]
readPrec :: ReadPrec UpdateTieringInput
$creadPrec :: ReadPrec UpdateTieringInput
readList :: ReadS [UpdateTieringInput]
$creadList :: ReadS [UpdateTieringInput]
readsPrec :: Int -> ReadS UpdateTieringInput
$creadsPrec :: Int -> ReadS UpdateTieringInput
Prelude.Read, Int -> UpdateTieringInput -> ShowS
[UpdateTieringInput] -> ShowS
UpdateTieringInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTieringInput] -> ShowS
$cshowList :: [UpdateTieringInput] -> ShowS
show :: UpdateTieringInput -> String
$cshow :: UpdateTieringInput -> String
showsPrec :: Int -> UpdateTieringInput -> ShowS
$cshowsPrec :: Int -> UpdateTieringInput -> ShowS
Prelude.Show, forall x. Rep UpdateTieringInput x -> UpdateTieringInput
forall x. UpdateTieringInput -> Rep UpdateTieringInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTieringInput x -> UpdateTieringInput
$cfrom :: forall x. UpdateTieringInput -> Rep UpdateTieringInput x
Prelude.Generic)

-- |
-- Create a value of 'UpdateTieringInput' 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:
--
-- 'freeTier', 'updateTieringInput_freeTier' - The possible Amazon Web Services Free Tier configurations.
newUpdateTieringInput ::
  -- | 'freeTier'
  UpdateFreeTierConfig ->
  UpdateTieringInput
newUpdateTieringInput :: UpdateFreeTierConfig -> UpdateTieringInput
newUpdateTieringInput UpdateFreeTierConfig
pFreeTier_ =
  UpdateTieringInput' {$sel:freeTier:UpdateTieringInput' :: UpdateFreeTierConfig
freeTier = UpdateFreeTierConfig
pFreeTier_}

-- | The possible Amazon Web Services Free Tier configurations.
updateTieringInput_freeTier :: Lens.Lens' UpdateTieringInput UpdateFreeTierConfig
updateTieringInput_freeTier :: Lens' UpdateTieringInput UpdateFreeTierConfig
updateTieringInput_freeTier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTieringInput' {UpdateFreeTierConfig
freeTier :: UpdateFreeTierConfig
$sel:freeTier:UpdateTieringInput' :: UpdateTieringInput -> UpdateFreeTierConfig
freeTier} -> UpdateFreeTierConfig
freeTier) (\s :: UpdateTieringInput
s@UpdateTieringInput' {} UpdateFreeTierConfig
a -> UpdateTieringInput
s {$sel:freeTier:UpdateTieringInput' :: UpdateFreeTierConfig
freeTier = UpdateFreeTierConfig
a} :: UpdateTieringInput)

instance Data.FromJSON UpdateTieringInput where
  parseJSON :: Value -> Parser UpdateTieringInput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpdateTieringInput"
      ( \Object
x ->
          UpdateFreeTierConfig -> UpdateTieringInput
UpdateTieringInput'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"FreeTier")
      )

instance Prelude.Hashable UpdateTieringInput where
  hashWithSalt :: Int -> UpdateTieringInput -> Int
hashWithSalt Int
_salt UpdateTieringInput' {UpdateFreeTierConfig
freeTier :: UpdateFreeTierConfig
$sel:freeTier:UpdateTieringInput' :: UpdateTieringInput -> UpdateFreeTierConfig
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` UpdateFreeTierConfig
freeTier

instance Prelude.NFData UpdateTieringInput where
  rnf :: UpdateTieringInput -> ()
rnf UpdateTieringInput' {UpdateFreeTierConfig
freeTier :: UpdateFreeTierConfig
$sel:freeTier:UpdateTieringInput' :: UpdateTieringInput -> UpdateFreeTierConfig
..} = forall a. NFData a => a -> ()
Prelude.rnf UpdateFreeTierConfig
freeTier

instance Data.ToJSON UpdateTieringInput where
  toJSON :: UpdateTieringInput -> Value
toJSON UpdateTieringInput' {UpdateFreeTierConfig
freeTier :: UpdateFreeTierConfig
$sel:freeTier:UpdateTieringInput' :: UpdateTieringInput -> UpdateFreeTierConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"FreeTier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= UpdateFreeTierConfig
freeTier)]
      )