{-# 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.CostExplorer.Types.EC2Specification
-- 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.CostExplorer.Types.EC2Specification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CostExplorer.Types.OfferingClass
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The Amazon EC2 hardware specifications that you want Amazon Web Services
-- to provide recommendations for.
--
-- /See:/ 'newEC2Specification' smart constructor.
data EC2Specification = EC2Specification'
  { -- | Indicates whether you want a recommendation for standard or convertible
    -- reservations.
    EC2Specification -> Maybe OfferingClass
offeringClass :: Prelude.Maybe OfferingClass
  }
  deriving (EC2Specification -> EC2Specification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EC2Specification -> EC2Specification -> Bool
$c/= :: EC2Specification -> EC2Specification -> Bool
== :: EC2Specification -> EC2Specification -> Bool
$c== :: EC2Specification -> EC2Specification -> Bool
Prelude.Eq, ReadPrec [EC2Specification]
ReadPrec EC2Specification
Int -> ReadS EC2Specification
ReadS [EC2Specification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EC2Specification]
$creadListPrec :: ReadPrec [EC2Specification]
readPrec :: ReadPrec EC2Specification
$creadPrec :: ReadPrec EC2Specification
readList :: ReadS [EC2Specification]
$creadList :: ReadS [EC2Specification]
readsPrec :: Int -> ReadS EC2Specification
$creadsPrec :: Int -> ReadS EC2Specification
Prelude.Read, Int -> EC2Specification -> ShowS
[EC2Specification] -> ShowS
EC2Specification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EC2Specification] -> ShowS
$cshowList :: [EC2Specification] -> ShowS
show :: EC2Specification -> String
$cshow :: EC2Specification -> String
showsPrec :: Int -> EC2Specification -> ShowS
$cshowsPrec :: Int -> EC2Specification -> ShowS
Prelude.Show, forall x. Rep EC2Specification x -> EC2Specification
forall x. EC2Specification -> Rep EC2Specification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EC2Specification x -> EC2Specification
$cfrom :: forall x. EC2Specification -> Rep EC2Specification x
Prelude.Generic)

-- |
-- Create a value of 'EC2Specification' 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:
--
-- 'offeringClass', 'eC2Specification_offeringClass' - Indicates whether you want a recommendation for standard or convertible
-- reservations.
newEC2Specification ::
  EC2Specification
newEC2Specification :: EC2Specification
newEC2Specification =
  EC2Specification' {$sel:offeringClass:EC2Specification' :: Maybe OfferingClass
offeringClass = forall a. Maybe a
Prelude.Nothing}

-- | Indicates whether you want a recommendation for standard or convertible
-- reservations.
eC2Specification_offeringClass :: Lens.Lens' EC2Specification (Prelude.Maybe OfferingClass)
eC2Specification_offeringClass :: Lens' EC2Specification (Maybe OfferingClass)
eC2Specification_offeringClass = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2Specification' {Maybe OfferingClass
offeringClass :: Maybe OfferingClass
$sel:offeringClass:EC2Specification' :: EC2Specification -> Maybe OfferingClass
offeringClass} -> Maybe OfferingClass
offeringClass) (\s :: EC2Specification
s@EC2Specification' {} Maybe OfferingClass
a -> EC2Specification
s {$sel:offeringClass:EC2Specification' :: Maybe OfferingClass
offeringClass = Maybe OfferingClass
a} :: EC2Specification)

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

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

instance Prelude.NFData EC2Specification where
  rnf :: EC2Specification -> ()
rnf EC2Specification' {Maybe OfferingClass
offeringClass :: Maybe OfferingClass
$sel:offeringClass:EC2Specification' :: EC2Specification -> Maybe OfferingClass
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe OfferingClass
offeringClass

instance Data.ToJSON EC2Specification where
  toJSON :: EC2Specification -> Value
toJSON EC2Specification' {Maybe OfferingClass
offeringClass :: Maybe OfferingClass
$sel:offeringClass:EC2Specification' :: EC2Specification -> Maybe OfferingClass
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"OfferingClass" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OfferingClass
offeringClass
          ]
      )