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

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

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

-- |
-- Create a value of 'ServiceSpecification' 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:
--
-- 'eC2Specification', 'serviceSpecification_eC2Specification' - The Amazon EC2 hardware specifications that you want Amazon Web Services
-- to provide recommendations for.
newServiceSpecification ::
  ServiceSpecification
newServiceSpecification :: ServiceSpecification
newServiceSpecification =
  ServiceSpecification'
    { $sel:eC2Specification:ServiceSpecification' :: Maybe EC2Specification
eC2Specification =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon EC2 hardware specifications that you want Amazon Web Services
-- to provide recommendations for.
serviceSpecification_eC2Specification :: Lens.Lens' ServiceSpecification (Prelude.Maybe EC2Specification)
serviceSpecification_eC2Specification :: Lens' ServiceSpecification (Maybe EC2Specification)
serviceSpecification_eC2Specification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSpecification' {Maybe EC2Specification
eC2Specification :: Maybe EC2Specification
$sel:eC2Specification:ServiceSpecification' :: ServiceSpecification -> Maybe EC2Specification
eC2Specification} -> Maybe EC2Specification
eC2Specification) (\s :: ServiceSpecification
s@ServiceSpecification' {} Maybe EC2Specification
a -> ServiceSpecification
s {$sel:eC2Specification:ServiceSpecification' :: Maybe EC2Specification
eC2Specification = Maybe EC2Specification
a} :: ServiceSpecification)

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

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

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

instance Data.ToJSON ServiceSpecification where
  toJSON :: ServiceSpecification -> Value
toJSON ServiceSpecification' {Maybe EC2Specification
eC2Specification :: Maybe EC2Specification
$sel:eC2Specification:ServiceSpecification' :: ServiceSpecification -> Maybe EC2Specification
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"EC2Specification" 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 EC2Specification
eC2Specification
          ]
      )