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

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.EC2Specification
import qualified Amazonka.Lens as Lens
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
(ServiceSpecification -> ServiceSpecification -> Bool)
-> (ServiceSpecification -> ServiceSpecification -> Bool)
-> Eq ServiceSpecification
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]
(Int -> ReadS ServiceSpecification)
-> ReadS [ServiceSpecification]
-> ReadPrec ServiceSpecification
-> ReadPrec [ServiceSpecification]
-> Read 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
(Int -> ServiceSpecification -> ShowS)
-> (ServiceSpecification -> String)
-> ([ServiceSpecification] -> ShowS)
-> Show ServiceSpecification
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. ServiceSpecification -> Rep ServiceSpecification x)
-> (forall x. Rep ServiceSpecification x -> ServiceSpecification)
-> Generic ServiceSpecification
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' :: Maybe EC2Specification -> ServiceSpecification
ServiceSpecification'
    { $sel:eC2Specification:ServiceSpecification' :: Maybe EC2Specification
eC2Specification =
        Maybe 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 :: (Maybe EC2Specification -> f (Maybe EC2Specification))
-> ServiceSpecification -> f ServiceSpecification
serviceSpecification_eC2Specification = (ServiceSpecification -> Maybe EC2Specification)
-> (ServiceSpecification
    -> Maybe EC2Specification -> ServiceSpecification)
-> Lens
     ServiceSpecification
     ServiceSpecification
     (Maybe EC2Specification)
     (Maybe 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 Core.FromJSON ServiceSpecification where
  parseJSON :: Value -> Parser ServiceSpecification
parseJSON =
    String
-> (Object -> Parser ServiceSpecification)
-> Value
-> Parser ServiceSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceSpecification"
      ( \Object
x ->
          Maybe EC2Specification -> ServiceSpecification
ServiceSpecification'
            (Maybe EC2Specification -> ServiceSpecification)
-> Parser (Maybe EC2Specification) -> Parser ServiceSpecification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EC2Specification)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EC2Specification")
      )

instance Prelude.Hashable ServiceSpecification

instance Prelude.NFData ServiceSpecification

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