{-# 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.EC2.Types.CreditSpecification
-- 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.EC2.Types.CreditSpecification where

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

-- | Describes the credit option for CPU usage of a T instance.
--
-- /See:/ 'newCreditSpecification' smart constructor.
data CreditSpecification = CreditSpecification'
  { -- | The credit option for CPU usage of a T instance.
    --
    -- Valid values: @standard@ | @unlimited@
    CreditSpecification -> Maybe Text
cpuCredits :: Prelude.Maybe Prelude.Text
  }
  deriving (CreditSpecification -> CreditSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreditSpecification -> CreditSpecification -> Bool
$c/= :: CreditSpecification -> CreditSpecification -> Bool
== :: CreditSpecification -> CreditSpecification -> Bool
$c== :: CreditSpecification -> CreditSpecification -> Bool
Prelude.Eq, ReadPrec [CreditSpecification]
ReadPrec CreditSpecification
Int -> ReadS CreditSpecification
ReadS [CreditSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreditSpecification]
$creadListPrec :: ReadPrec [CreditSpecification]
readPrec :: ReadPrec CreditSpecification
$creadPrec :: ReadPrec CreditSpecification
readList :: ReadS [CreditSpecification]
$creadList :: ReadS [CreditSpecification]
readsPrec :: Int -> ReadS CreditSpecification
$creadsPrec :: Int -> ReadS CreditSpecification
Prelude.Read, Int -> CreditSpecification -> ShowS
[CreditSpecification] -> ShowS
CreditSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreditSpecification] -> ShowS
$cshowList :: [CreditSpecification] -> ShowS
show :: CreditSpecification -> String
$cshow :: CreditSpecification -> String
showsPrec :: Int -> CreditSpecification -> ShowS
$cshowsPrec :: Int -> CreditSpecification -> ShowS
Prelude.Show, forall x. Rep CreditSpecification x -> CreditSpecification
forall x. CreditSpecification -> Rep CreditSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreditSpecification x -> CreditSpecification
$cfrom :: forall x. CreditSpecification -> Rep CreditSpecification x
Prelude.Generic)

-- |
-- Create a value of 'CreditSpecification' 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:
--
-- 'cpuCredits', 'creditSpecification_cpuCredits' - The credit option for CPU usage of a T instance.
--
-- Valid values: @standard@ | @unlimited@
newCreditSpecification ::
  CreditSpecification
newCreditSpecification :: CreditSpecification
newCreditSpecification =
  CreditSpecification' {$sel:cpuCredits:CreditSpecification' :: Maybe Text
cpuCredits = forall a. Maybe a
Prelude.Nothing}

-- | The credit option for CPU usage of a T instance.
--
-- Valid values: @standard@ | @unlimited@
creditSpecification_cpuCredits :: Lens.Lens' CreditSpecification (Prelude.Maybe Prelude.Text)
creditSpecification_cpuCredits :: Lens' CreditSpecification (Maybe Text)
creditSpecification_cpuCredits = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreditSpecification' {Maybe Text
cpuCredits :: Maybe Text
$sel:cpuCredits:CreditSpecification' :: CreditSpecification -> Maybe Text
cpuCredits} -> Maybe Text
cpuCredits) (\s :: CreditSpecification
s@CreditSpecification' {} Maybe Text
a -> CreditSpecification
s {$sel:cpuCredits:CreditSpecification' :: Maybe Text
cpuCredits = Maybe Text
a} :: CreditSpecification)

instance Data.FromXML CreditSpecification where
  parseXML :: [Node] -> Either String CreditSpecification
parseXML [Node]
x =
    Maybe Text -> CreditSpecification
CreditSpecification'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"cpuCredits")

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

instance Prelude.NFData CreditSpecification where
  rnf :: CreditSpecification -> ()
rnf CreditSpecification' {Maybe Text
cpuCredits :: Maybe Text
$sel:cpuCredits:CreditSpecification' :: CreditSpecification -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cpuCredits